1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_alloc.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_alloc.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,4 +1,5 @@
1.4 /*
1.5 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.6 *
1.7 * Copyright (c) 1996,1997
1.8 * Silicon Graphics Computer Systems, Inc.
1.9 @@ -6,13 +7,13 @@
1.10 * Copyright (c) 1997
1.11 * Moscow Center for SPARC Technology
1.12 *
1.13 - * Copyright (c) 1999
1.14 + * Copyright (c) 1999
1.15 * Boris Fomitchev
1.16 *
1.17 * This material is provided "as is", with absolutely no warranty expressed
1.18 * or implied. Any use is at your own risk.
1.19 *
1.20 - * Permission to use or copy this software for any purpose is hereby granted
1.21 + * Permission to use or copy this software for any purpose is hereby granted
1.22 * without fee, provided the above notices are retained on all copies.
1.23 * Permission to modify the code and to distribute modified code is granted,
1.24 * provided the above notices are retained, and a notice that the code was
1.25 @@ -27,118 +28,107 @@
1.26 #ifndef _STLP_INTERNAL_ALLOC_H
1.27 #define _STLP_INTERNAL_ALLOC_H
1.28
1.29 -# ifndef _STLP_CSTDDEF
1.30 -# include <cstddef>
1.31 -# endif
1.32 -
1.33 -#if !defined (_STLP_DEBUG_H) && (defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS))
1.34 -# include <stl/debug/_debug.h>
1.35 +#ifndef _STLP_INTERNAL_CSTDDEF
1.36 +# include <stl/_cstddef.h>
1.37 #endif
1.38
1.39 -# ifndef _STLP_CSTDLIB
1.40 -# include <cstdlib>
1.41 -# endif
1.42 -# ifndef _STLP_CSTRING
1.43 -# include <cstring>
1.44 -# endif
1.45 +#if !defined (_STLP_DEBUG_H) && (defined(_STLP_DEBUG) || defined(_STLP_ASSERTIONS) || defined(_STLP_DEBUG_ALLOC))
1.46 +# include <stl/debug/_debug.h>
1.47 +#endif
1.48
1.49 -# ifndef __THROW_BAD_ALLOC
1.50 +#ifndef _STLP_INTERNAL_CSTDLIB
1.51 +# include <stl/_cstdlib.h>
1.52 +#endif
1.53 +
1.54 +#ifndef _STLP_INTERNAL_CSTRING
1.55 +# include <stl/_cstring.h>
1.56 +#endif
1.57 +
1.58 +#ifndef _STLP_INTERNAL_ALGOBASE_H
1.59 +# include <stl/_algobase.h>
1.60 +#endif
1.61 +
1.62 +#ifndef __THROW_BAD_ALLOC
1.63 # if !defined(_STLP_USE_EXCEPTIONS)
1.64 -# if !defined (_STLP_CSTDIO)
1.65 -# include <cstdio>
1.66 -# endif
1.67 -# if !defined (_STLP_CSTDLIB)
1.68 -# include <cstdlib>
1.69 -# endif
1.70 -# define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
1.71 -# else /* !defined(_STLP_USE_EXCEPTIONS) */
1.72 -# define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc()
1.73 -# endif /* !defined(_STLP_USE_EXCEPTIONS) */
1.74 -# endif /* __THROW_BAD_ALLOC */
1.75 +# ifndef _STLP_INTERNAL_CSTDIO
1.76 +# include <stl/_cstdio.h>
1.77 +# endif
1.78 +# define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
1.79 +# else
1.80 +# define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc()
1.81 +# endif
1.82 +#endif
1.83
1.84 -# ifndef _STLP_INTERNAL_NEW_HEADER
1.85 +#ifndef _STLP_INTERNAL_NEW_HEADER
1.86 # include <stl/_new.h>
1.87 -# endif
1.88 -
1.89 -// #if ! defined (__SYMBIAN32__)
1.90 -#if /* defined (_STLP_THREADS) && */ ! defined (_STLP_INTERNAL_THREADS_H)
1.91 -# include <stl/_threads.h>
1.92 -// #endif
1.93 #endif
1.94
1.95 #ifndef _STLP_INTERNAL_CONSTRUCT_H
1.96 -# include <stl/_construct.h>
1.97 +# include <stl/_construct.h>
1.98 #endif
1.99
1.100 -#ifndef __ALLOC
1.101 -# define __ALLOC __sgi_alloc
1.102 -#endif
1.103 -
1.104 -# ifndef __RESTRICT
1.105 -# define __RESTRICT
1.106 -# endif
1.107 -
1.108 -#if defined (_STLP_THREADS) || (defined(_STLP_OWN_IOSTREAMS) && ! defined (_STLP_NO_THREADS) && ! defined (_NOTHREADS) )
1.109 -# define _STLP_NODE_ALLOCATOR_THREADS true
1.110 -#else
1.111 -# define _STLP_NODE_ALLOCATOR_THREADS false
1.112 +#if !defined (__ALLOC)
1.113 +# define __ALLOC __sgi_alloc
1.114 #endif
1.115
1.116 _STLP_BEGIN_NAMESPACE
1.117
1.118 -# if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.119 +#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.120 template <class _Tp, class _Alloc> struct __allocator;
1.121 -# endif
1.122 -
1.123 -#ifndef _STLP_NO_NODE_ALLOC
1.124 +#endif
1.125
1.126 // Malloc-based allocator. Typically slower than default alloc below.
1.127 // Typically thread-safe and more storage efficient.
1.128
1.129 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.130 typedef void (* __oom_handler_type)();
1.131 +#endif
1.132
1.133 -template <int __inst>
1.134 -class __malloc_alloc {
1.135 -private:
1.136 - static void* _STLP_CALL _S_oom_malloc(size_t);
1.137 - static __oom_handler_type __oom_handler;
1.138 +class _STLP_CLASS_DECLSPEC __malloc_alloc {
1.139 public:
1.140 // this one is needed for proper simple_alloc wrapping
1.141 typedef char value_type;
1.142 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.143 +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.144 template <class _Tp1> struct rebind {
1.145 - typedef __allocator<_Tp1, __malloc_alloc<__inst> > other;
1.146 + typedef __allocator<_Tp1, __malloc_alloc> other;
1.147 };
1.148 -# endif
1.149 - static void* _STLP_CALL allocate(size_t __n) {
1.150 - void* __result = malloc(__n);
1.151 - if (0 == __result) __result = _S_oom_malloc(__n);
1.152 +#endif
1.153 + static void* _STLP_CALL allocate(size_t& __n)
1.154 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.155 + ;
1.156 +#else
1.157 + {
1.158 + void *__result = malloc(__n);
1.159 +# if defined (_STLP_MALLOC_USABLE_SIZE)
1.160 + if (__result != 0) {
1.161 + __n = _STLP_MALLOC_USABLE_SIZE(__result);
1.162 + }
1.163 +# endif
1.164 + if (__result == 0) {
1.165 + __THROW_BAD_ALLOC;
1.166 + }
1.167 return __result;
1.168 }
1.169 +#endif
1.170 +
1.171 static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
1.172 - static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f) {
1.173 - __oom_handler_type __old = __oom_handler;
1.174 - __oom_handler = __f;
1.175 - return(__old);
1.176 - }
1.177 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.178 + static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
1.179 +#endif
1.180 };
1.181
1.182 -# endif
1.183 -
1.184 // New-based allocator. Typically slower than default alloc below.
1.185 // Typically thread-safe and more storage efficient.
1.186 class _STLP_CLASS_DECLSPEC __new_alloc {
1.187 public:
1.188 // this one is needed for proper simple_alloc wrapping
1.189 typedef char value_type;
1.190 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined(_STLP_USE_RAW_SGI_ALLOCATORS)
1.191 +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.192 template <class _Tp1> struct rebind {
1.193 typedef __allocator<_Tp1, __new_alloc > other;
1.194 };
1.195 -# endif
1.196 - static void* _STLP_CALL allocate(size_t __n) {
1.197 - return __stl_new(__n);
1.198 - }
1.199 +#endif
1.200 + static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
1.201 static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
1.202 };
1.203
1.204 @@ -162,128 +152,121 @@
1.205 _STLP_UINT32_T _M_size;
1.206 }; // that is 8 bytes for sure
1.207 // Sunpro CC has bug on enums, so extra_before/after set explicitly
1.208 - enum { __pad=8, __magic=0xdeba, __deleted_magic = 0xdebd,
1.209 - __shred_byte= _STLP_SHRED_BYTE
1.210 - };
1.211 + enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
1.212 + __shred_byte = _STLP_SHRED_BYTE };
1.213
1.214 enum { __extra_before = 16, __extra_after = 8 };
1.215 // Size of space used to store size. Note
1.216 // that this must be large enough to preserve
1.217 // alignment.
1.218 static size_t _STLP_CALL __extra_before_chunk() {
1.219 - return (long)__extra_before/sizeof(value_type)+
1.220 - (size_t)((long)__extra_before%sizeof(value_type)>0);
1.221 + return (long)__extra_before / sizeof(value_type) +
1.222 + (size_t)((long)__extra_before % sizeof(value_type) > 0);
1.223 }
1.224 static size_t _STLP_CALL __extra_after_chunk() {
1.225 - return (long)__extra_after/sizeof(value_type)+
1.226 - (size_t)((long)__extra_after%sizeof(value_type)>0);
1.227 + return (long)__extra_after / sizeof(value_type) +
1.228 + (size_t)((long)__extra_after % sizeof(value_type) > 0);
1.229 }
1.230 public:
1.231 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.232 +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.233 template <class _Tp1> struct rebind {
1.234 typedef __allocator< _Tp1, __debug_alloc<_Alloc> > other;
1.235 };
1.236 -# endif
1.237 +#endif
1.238 __debug_alloc() {}
1.239 ~__debug_alloc() {}
1.240 - static void * _STLP_CALL allocate(size_t);
1.241 + static void* _STLP_CALL allocate(size_t);
1.242 static void _STLP_CALL deallocate(void *, size_t);
1.243 };
1.244
1.245 -# if defined(__OS400__)
1.246 -enum {_ALIGN = 16, _ALIGN_SHIFT=4, _MAX_BYTES = 256};
1.247 -# define _STLP_NFREELISTS 16
1.248 -# else
1.249 -enum {_ALIGN = 8, _ALIGN_SHIFT=3, _MAX_BYTES = 128};
1.250 -# define _STLP_NFREELISTS 16
1.251 -# endif /* __OS400__ */
1.252 +# if defined (__OS400__) || defined (_WIN64)
1.253 +enum {_ALIGN = 16, _ALIGN_SHIFT = 4, _MAX_BYTES = 256};
1.254 +# else
1.255 +enum {_ALIGN = 8, _ALIGN_SHIFT = 3, _MAX_BYTES = 128};
1.256 +# endif /* __OS400__ */
1.257
1.258 -#ifndef _STLP_NO_NODE_ALLOC
1.259 -
1.260 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.261 // Default node allocator.
1.262 // With a reasonable compiler, this should be roughly as fast as the
1.263 // original STL class-specific allocators, but with less fragmentation.
1.264 -// Default_alloc_template parameters are experimental and MAY
1.265 -// DISAPPEAR in the future. Clients should just use alloc for now.
1.266 -//
1.267 -// Important implementation properties:
1.268 -// 1. If the client request an object of size > _MAX_BYTES, the resulting
1.269 -// object will be obtained directly from malloc.
1.270 -// 2. In all other cases, we allocate an object of size exactly
1.271 -// _S_round_up(requested_size). Thus the client has enough size
1.272 -// information that we can return the object to the proper free list
1.273 -// without permanently losing part of the object.
1.274 -//
1.275 +class _STLP_CLASS_DECLSPEC __node_alloc {
1.276 + _STLP_DECLSPEC static void * _STLP_CALL _M_allocate(size_t& __n);
1.277 + /* __p may not be 0 */
1.278 + _STLP_DECLSPEC static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
1.279
1.280 -// The first template parameter specifies whether more than one thread
1.281 -// may use this allocator. It is safe to allocate an object from
1.282 -// one instance of a default_alloc and deallocate it with another
1.283 -// one. This effectively transfers its ownership to the second one.
1.284 -// This may have undesirable effects on reference locality.
1.285 -// The second parameter is unreferenced and serves only to allow the
1.286 -// creation of multiple default_alloc instances.
1.287 -
1.288 -class _STLP_CLASS_DECLSPEC _Node_alloc_obj {
1.289 -public:
1.290 - _Node_alloc_obj * _M_free_list_link;
1.291 -};
1.292 -
1.293 -template <bool __threads, int __inst>
1.294 -class __node_alloc {
1.295 - _STLP_PRIVATE:
1.296 - static inline size_t _STLP_CALL _S_round_up(size_t __bytes) { return (((__bytes) + (size_t)_ALIGN-1) & ~((size_t)_ALIGN - 1)); }
1.297 - typedef _Node_alloc_obj _Obj;
1.298 -private:
1.299 - // Returns an object of size __n, and optionally adds to size __n free list.
1.300 - static void* _STLP_CALL _S_refill(size_t __n);
1.301 - // Allocates a chunk for nobjs of size size. nobjs may be reduced
1.302 - // if it is inconvenient to allocate the requested number.
1.303 - static char* _STLP_CALL _S_chunk_alloc(size_t __p_size, int& __nobjs);
1.304 - // Chunk allocation state.
1.305 - static _Node_alloc_obj * _STLP_VOLATILE _S_free_list[_STLP_NFREELISTS];
1.306 - static char* _S_start_free;
1.307 - static char* _S_end_free;
1.308 - static size_t _S_heap_size;
1.309 - static void * _STLP_CALL _M_allocate(size_t __n);
1.310 - /* __p may not be 0 */
1.311 - static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
1.312 public:
1.313 // this one is needed for proper simple_alloc wrapping
1.314 typedef char value_type;
1.315 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.316 +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.317 template <class _Tp1> struct rebind {
1.318 - typedef __allocator<_Tp1, __node_alloc<__threads, __inst> > other;
1.319 + typedef __allocator<_Tp1, __node_alloc> other;
1.320 };
1.321 -# endif
1.322 +# endif
1.323 /* __n must be > 0 */
1.324 - static void * _STLP_CALL allocate(size_t __n) {
1.325 -return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
1.326 + static void* _STLP_CALL allocate(size_t& __n)
1.327 + { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
1.328 /* __p may not be 0 */
1.329 - static void _STLP_CALL deallocate(void *__p, size_t __n) {
1.330 -if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
1.331 + static void _STLP_CALL deallocate(void *__p, size_t __n)
1.332 + { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
1.333 };
1.334
1.335 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.336 -_STLP_EXPORT_TEMPLATE_CLASS __malloc_alloc<0>;
1.337 -_STLP_EXPORT_TEMPLATE_CLASS __node_alloc<_STLP_NODE_ALLOCATOR_THREADS, 0>;
1.338 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.339 -typedef __node_alloc<_STLP_NODE_ALLOCATOR_THREADS, 0> _Node_alloc;
1.340 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.341 -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<_Node_alloc>;
1.342 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.343 +_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
1.344 +# endif
1.345 +
1.346 +#endif /* _STLP_USE_NO_IOSTREAMS */
1.347 +
1.348 +#if defined (_STLP_USE_TEMPLATE_EXPORT)
1.349 _STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
1.350 -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc<0> >;
1.351 -# endif
1.352 -
1.353 +_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
1.354 #endif
1.355
1.356 -# if defined (_STLP_USE_PERTHREAD_ALLOC)
1.357 +/* macro to convert the allocator for initialization
1.358 + * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
1.359 +#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.360 +/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
1.361 + * not used implicitly to convert allocator parameter, so let us do it explicitly */
1.362 +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
1.363 +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
1.364 +# else
1.365 +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
1.366 +# endif
1.367 +/* else convert, but only if partial specialization works, since else
1.368 + * Container::allocator_type won't be different */
1.369 +#else
1.370 +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
1.371 +#endif /* _STLP_MEMBER_TEMPLATES || !_STLP_CLASS_PARTIAL_SPECIALIZATION */
1.372 +
1.373 +// Another allocator adaptor: _Alloc_traits. This serves two
1.374 +// purposes. First, make it possible to write containers that can use
1.375 +// either SGI-style allocators or standard-conforming allocator.
1.376 +
1.377 +// The fully general version.
1.378 +template <class _Tp, class _Allocator>
1.379 +struct _Alloc_traits {
1.380 + typedef _Allocator _Orig;
1.381 +#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
1.382 + typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
1.383 + typedef typename _Rebind_type::other allocator_type;
1.384 + static allocator_type create_allocator(const _Orig& __a)
1.385 + { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
1.386 +#else
1.387 + // this is not actually true, used only to pass this type through
1.388 + // to dynamic overload selection in _STLP_alloc_proxy methods
1.389 + typedef _Allocator allocator_type;
1.390 +#endif /* !_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
1.391 +};
1.392 +
1.393 +#if defined (_STLP_USE_PERTHREAD_ALLOC)
1.394
1.395 _STLP_END_NAMESPACE
1.396 +
1.397 // include additional header here
1.398 -# include <stl/_pthread_alloc.h>
1.399 +# include <stl/_pthread_alloc.h>
1.400 +
1.401 _STLP_BEGIN_NAMESPACE
1.402
1.403 -# if defined ( _STLP_DEBUG_ALLOC )
1.404 +# if defined (_STLP_DEBUG_ALLOC)
1.405 typedef __debug_alloc<__pthread_alloc> __sgi_alloc;
1.406 # else
1.407 typedef __pthread_alloc __sgi_alloc;
1.408 @@ -292,45 +275,45 @@
1.409 typedef __pthread_alloc __single_client_alloc;
1.410 typedef __pthread_alloc __multithreaded_alloc;
1.411
1.412 -# else
1.413 +#else /* _STLP_USE_PERTHREAD_ALLOC */
1.414
1.415 -# if defined ( _STLP_USE_NEWALLOC )
1.416 +# if defined (_STLP_USE_NEWALLOC)
1.417
1.418 -# if defined ( _STLP_DEBUG_ALLOC )
1.419 +# if defined (_STLP_DEBUG_ALLOC)
1.420 typedef __debug_alloc<__new_alloc> __sgi_alloc;
1.421 -# else
1.422 +# else
1.423 typedef __new_alloc __sgi_alloc;
1.424 -# endif /* _STLP_DEBUG_ALLOC */
1.425 +# endif /* _STLP_DEBUG_ALLOC */
1.426
1.427 typedef __new_alloc __single_client_alloc;
1.428 typedef __new_alloc __multithreaded_alloc;
1.429
1.430 # elif defined (_STLP_USE_MALLOC)
1.431
1.432 -# if defined ( _STLP_DEBUG_ALLOC )
1.433 -typedef __debug_alloc<__malloc_alloc<0> > __sgi_alloc;
1.434 -# else
1.435 -typedef __malloc_alloc<0> __sgi_alloc;
1.436 -# endif /* _STLP_DEBUG_ALLOC */
1.437 +# if defined (_STLP_DEBUG_ALLOC)
1.438 +typedef __debug_alloc<__malloc_alloc> __sgi_alloc;
1.439 +# else
1.440 +typedef __malloc_alloc __sgi_alloc;
1.441 +# endif /* _STLP_DEBUG_ALLOC */
1.442
1.443 -typedef __malloc_alloc<0> __single_client_alloc;
1.444 -typedef __malloc_alloc<0> __multithreaded_alloc;
1.445 +typedef __malloc_alloc __single_client_alloc;
1.446 +typedef __malloc_alloc __multithreaded_alloc;
1.447
1.448 -# else
1.449 +# else
1.450
1.451 -# if defined ( _STLP_DEBUG_ALLOC )
1.452 -typedef __debug_alloc<_Node_alloc> __sgi_alloc;
1.453 -# else
1.454 -typedef _Node_alloc __sgi_alloc;
1.455 -# endif
1.456 +# if defined (_STLP_DEBUG_ALLOC)
1.457 +typedef __debug_alloc<__node_alloc> __sgi_alloc;
1.458 +# else
1.459 +typedef __node_alloc __sgi_alloc;
1.460 +# endif
1.461
1.462 -typedef __node_alloc<false, 0> __single_client_alloc;
1.463 -typedef __node_alloc<true, 0> __multithreaded_alloc;
1.464 +typedef __node_alloc __single_client_alloc;
1.465 +typedef __node_alloc __multithreaded_alloc;
1.466
1.467 # endif /* _STLP_USE_NEWALLOC */
1.468 -# endif /* PTHREAD_ALLOC */
1.469 +#endif /* _STLP_USE_PERTHREAD_ALLOC */
1.470
1.471 -// This implements allocators as specified in the C++ standard.
1.472 +// This implements allocators as specified in the C++ standard.
1.473 //
1.474 // Note that standard-conforming allocators use many language features
1.475 // that are not yet widely implemented. In particular, they rely on
1.476 @@ -338,48 +321,127 @@
1.477 // templates, the typename keyword, and the use of the template keyword
1.478 // to refer to a template member of a dependent type.
1.479
1.480 +/*
1.481 template <class _Tp>
1.482 -class allocator {
1.483 +struct _AllocatorAux {
1.484 + typedef _Tp* pointer;
1.485 + typedef const _Tp* const_pointer;
1.486 + typedef _Tp& reference;
1.487 + typedef const _Tp& const_reference;
1.488 +
1.489 + pointer address(reference __x) const {return &__x;}
1.490 + const_pointer address(const_reference __x) const { return &__x; }
1.491 +};
1.492 +
1.493 +template <class _Tp>
1.494 +struct _AllocatorAux<const _Tp> {
1.495 + typedef _Tp* pointer;
1.496 + typedef const _Tp* const_pointer;
1.497 + typedef _Tp& reference;
1.498 + typedef const _Tp& const_reference;
1.499 +
1.500 + const_pointer address(const_reference __x) const { return &__x; }
1.501 +};
1.502 +*/
1.503 +
1.504 +template <class _Tp>
1.505 +class allocator //: public _AllocatorAux<_Tp>
1.506 +/* A small helper struct to recognize STLport allocator implementation
1.507 + * from any user specialization one.
1.508 + */
1.509 + : public __stlport_class<allocator<_Tp> > {
1.510 public:
1.511 -
1.512 typedef _Tp value_type;
1.513 - typedef value_type * pointer;
1.514 + typedef _Tp* pointer;
1.515 typedef const _Tp* const_pointer;
1.516 typedef _Tp& reference;
1.517 typedef const _Tp& const_reference;
1.518 typedef size_t size_type;
1.519 typedef ptrdiff_t difference_type;
1.520 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.521 +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.522 template <class _Tp1> struct rebind {
1.523 typedef allocator<_Tp1> other;
1.524 };
1.525 -# endif
1.526 +#endif
1.527 allocator() _STLP_NOTHROW {}
1.528 - # if defined (_STLP_MEMBER_TEMPLATES)
1.529 +#if defined (_STLP_MEMBER_TEMPLATES)
1.530 template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
1.531 - # endif
1.532 +#endif
1.533 allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
1.534 + allocator(__move_source<allocator<_Tp> > /*src*/) _STLP_NOTHROW {}
1.535 ~allocator() _STLP_NOTHROW {}
1.536 - pointer address(reference __x) const { return &__x; }
1.537 + pointer address(reference __x) const {return &__x;}
1.538 const_pointer address(const_reference __x) const { return &__x; }
1.539 // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
1.540 - _Tp* allocate(size_type __n, const void* = 0) {
1.541 - return __n != 0 ? __REINTERPRET_CAST(value_type*,__sgi_alloc::allocate(__n * sizeof(value_type))) : 0;
1.542 + _Tp* allocate(size_type __n, const void* = 0) {
1.543 + if (__n > max_size()) {
1.544 + __THROW_BAD_ALLOC;
1.545 + }
1.546 + if (__n != 0) {
1.547 + size_type __buf_size = __n * sizeof(value_type);
1.548 + _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
1.549 +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
1.550 + if (__ret != 0) {
1.551 + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
1.552 + }
1.553 +#endif
1.554 + return __ret;
1.555 + }
1.556 + else
1.557 + return 0;
1.558 }
1.559 // __p is permitted to be a null pointer, only if n==0.
1.560 void deallocate(pointer __p, size_type __n) {
1.561 _STLP_ASSERT( (__p == 0) == (__n == 0) )
1.562 - if (__p != 0) __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
1.563 + if (__p != 0) {
1.564 +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
1.565 + memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
1.566 +#endif
1.567 + __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
1.568 + }
1.569 }
1.570 // backwards compatibility
1.571 void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
1.572 size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
1.573 - void construct(pointer __p, const _Tp& __val) { _STLP_STD::_Construct(__p, __val); }
1.574 + void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
1.575 void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
1.576 -# if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))
1.577 - template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
1.578 +#if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))
1.579 + template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
1.580 template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
1.581 -# endif
1.582 +#endif
1.583 +
1.584 +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.585 + //This is just to make swap workaround for compiler without template function partial
1.586 + //happy.
1.587 + void swap(allocator<_Tp>&) {}
1.588 +#endif
1.589 +
1.590 +#if defined (_STLP_NO_EXTENSIONS)
1.591 + /* STLport extension giving rounded size of an allocated memory buffer
1.592 + * This method do not have to be part of a user defined allocator implementation
1.593 + * and won't even be called if such a function was granted.
1.594 + */
1.595 +protected:
1.596 +#endif
1.597 + _Tp* allocate(size_type __n, size_type& __allocated_n) {
1.598 + if (__n > max_size()) {
1.599 + __THROW_BAD_ALLOC;
1.600 + }
1.601 +
1.602 + if (__n != 0) {
1.603 + size_type __buf_size = __n * sizeof(value_type);
1.604 + _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
1.605 +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
1.606 + if (__ret != 0) {
1.607 + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
1.608 + }
1.609 +#endif
1.610 + __allocated_n = __buf_size / sizeof(value_type);
1.611 + return __ret;
1.612 + }
1.613 + else
1.614 + return 0;
1.615 + }
1.616 };
1.617
1.618 _STLP_TEMPLATE_NULL
1.619 @@ -389,83 +451,89 @@
1.620 typedef ptrdiff_t difference_type;
1.621 typedef void* pointer;
1.622 typedef const void* const_pointer;
1.623 -# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.624 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.625 typedef void value_type;
1.626 -# endif
1.627 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.628 +#endif
1.629 +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.630 template <class _Tp1> struct rebind {
1.631 typedef allocator<_Tp1> other;
1.632 };
1.633 -# endif
1.634 -# if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
1.635 +#endif
1.636 +#if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
1.637 template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
1.638 template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
1.639 -# endif
1.640 +#endif
1.641 };
1.642
1.643 -#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
1.644 +#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
1.645 template <class _T1, class _T2> inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return true; }
1.646 template <class _T1, class _T2> inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return false; }
1.647 #endif
1.648
1.649 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.650 +#if defined (_STLP_USE_TEMPLATE_EXPORT)
1.651 _STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
1.652 # if defined (_STLP_HAS_WCHAR_T)
1.653 _STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
1.654 # endif
1.655 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.656 +# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.657 +_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
1.658 +# endif
1.659 +#endif
1.660
1.661 -// Another allocator adaptor: _Alloc_traits. This serves two
1.662 -// purposes. First, make it possible to write containers that can use
1.663 -// either SGI-style allocators or standard-conforming allocator.
1.664 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.665
1.666 -// The fully general version.
1.667 -template <class _Tp, class _Allocator>
1.668 -struct _Alloc_traits
1.669 -{
1.670 - typedef _Allocator _Orig;
1.671 -# if defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM)
1.672 - typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
1.673 - typedef typename _Rebind_type::other allocator_type;
1.674 - static allocator_type create_allocator(const _Orig& __a) { return allocator_type(__a); }
1.675 -# else
1.676 - // this is not actually true, used only to pass this type through
1.677 - // to dynamic overload selection in _STLP_alloc_proxy methods
1.678 - typedef _Allocator allocator_type;
1.679 -# endif /* _STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
1.680 +template <class _Tp>
1.681 +struct __alloc_type_traits {
1.682 +#if !defined (__BORLANDC__)
1.683 + typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
1.684 +#else
1.685 + enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
1.686 + typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
1.687 +#endif
1.688 + //The default allocator implementation which is recognize thanks to the
1.689 + //__stlport_class inheritance is a stateless object so:
1.690 + typedef _STLportAlloc has_trivial_default_constructor;
1.691 + typedef _STLportAlloc has_trivial_copy_constructor;
1.692 + typedef _STLportAlloc has_trivial_assignment_operator;
1.693 + typedef _STLportAlloc has_trivial_destructor;
1.694 + typedef _STLportAlloc is_POD_type;
1.695 };
1.696
1.697 -#ifndef _STLP_FORCE_ALLOCATORS
1.698 -#define _STLP_FORCE_ALLOCATORS(a,y)
1.699 +_STLP_MOVE_TO_STD_NAMESPACE
1.700 +
1.701 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.702 +template <class _Tp>
1.703 +struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
1.704 +#else
1.705 +_STLP_TEMPLATE_NULL
1.706 +struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
1.707 +# if defined (_STLP_HAS_WCHAR_T)
1.708 +_STLP_TEMPLATE_NULL
1.709 +struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
1.710 +# endif
1.711 +# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.712 +_STLP_TEMPLATE_NULL
1.713 +struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
1.714 +# endif
1.715 #endif
1.716
1.717 -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.718 +
1.719 +#if !defined (_STLP_FORCE_ALLOCATORS)
1.720 +# define _STLP_FORCE_ALLOCATORS(a,y)
1.721 +#endif
1.722 +
1.723 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.724 // The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
1.725 template <class _Tp, class _Tp1>
1.726 struct _Alloc_traits<_Tp, allocator<_Tp1> > {
1.727 typedef allocator<_Tp1> _Orig;
1.728 typedef allocator<_Tp> allocator_type;
1.729 - static allocator_type create_allocator(const allocator<_Tp1 >& __a) { return allocator_type(__a); }
1.730 + static allocator_type create_allocator(const allocator<_Tp1 >& __a)
1.731 + { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
1.732 };
1.733 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.734
1.735 -/* macro to convert the allocator for initialization
1.736 - * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
1.737 -#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.738 -/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
1.739 - * not used implicitly to convert allocator parameter, so let us do it explicitly */
1.740 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
1.741 -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
1.742 -# else
1.743 -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
1.744 -# endif
1.745 -/* else convert, but only if partial specialization works, since else
1.746 - * Container::allocator_type won't be different */
1.747 -#else
1.748 -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
1.749 -#endif
1.750 -
1.751 -# if defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM)
1.752 +#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
1.753 template <class _Tp, class _Alloc>
1.754 inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
1.755 __stl_alloc_create(const _Alloc& __a, const _Tp*) {
1.756 @@ -481,59 +549,114 @@
1.757 template <class _Tp1, class _Tp2>
1.758 inline allocator<_Tp2> _STLP_CALL
1.759 __stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
1.760 -#endif /* _STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
1.761 +#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
1.762
1.763 -# ifdef _STLP_USE_RAW_SGI_ALLOCATORS
1.764 +#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
1.765 // move obsolete stuff out of the way
1.766 -# include <stl/_alloc_old.h>
1.767 -# endif
1.768 +# include <stl/_alloc_old.h>
1.769 +#endif
1.770 +
1.771 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.772
1.773 // inheritance is being used for EBO optimization
1.774 template <class _Value, class _Tp, class _MaybeReboundAlloc>
1.775 class _STLP_alloc_proxy : public _MaybeReboundAlloc {
1.776 private:
1.777 typedef _MaybeReboundAlloc _Base;
1.778 + typedef typename _Base::size_type size_type;
1.779 typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
1.780 public:
1.781 _Value _M_data;
1.782 - inline _STLP_alloc_proxy(const _MaybeReboundAlloc& __a, _Value __p) : _MaybeReboundAlloc(__a), _M_data(__p) {}
1.783
1.784 -# if 0
1.785 - inline _STLP_alloc_proxy(const _Self& __x) : _MaybeReboundAlloc(__x), _M_data(__x._M_data) {}
1.786 - // construction/destruction
1.787 - inline _Self& operator = (const _Self& __x) {
1.788 - *(_MaybeReboundAlloc*)this = *(_MaybeReboundAlloc*)__x;
1.789 - _M_data = __x._M_data; return *this;
1.790 - }
1.791 - inline _Self& operator = (const _Base& __x) { ((_Base&)*this) = __x; return *this; }
1.792 -# endif
1.793 + _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
1.794 + _MaybeReboundAlloc(__a), _M_data(__p) {}
1.795 +
1.796 + _STLP_alloc_proxy (__move_source<_Self> src) :
1.797 + _MaybeReboundAlloc(_STLP_PRIV _AsMoveSource<_Base>(src.get())),
1.798 + _M_data(_STLP_PRIV _AsMoveSource<_Value>(src.get()._M_data)) {}
1.799 +
1.800 +private:
1.801 + /* Following are helper methods to detect stateless allocators and avoid
1.802 + * swap in this case. For some compilers (VC6) it is a workaround for a
1.803 + * compiler bug in the Empty Base class Optimization feature, for others
1.804 + * it is a small optimization or nothing if no EBO. */
1.805 + void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
1.806 + {}
1.807 +
1.808 + void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
1.809 + _MaybeReboundAlloc &__base_this = *this;
1.810 + _MaybeReboundAlloc &__base_x = __x;
1.811 + _STLP_STD::swap(__base_this, __base_x);
1.812 + }
1.813 +
1.814 +public:
1.815 + void _M_swap_alloc(_Self& __x) {
1.816 +#if !defined (__BORLANDC__)
1.817 + typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
1.818 +#else
1.819 + typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
1.820 +#endif
1.821 + _M_swap_alloc(__x, _StatelessAlloc());
1.822 + }
1.823 +
1.824 + /* We need to define the following swap implementation for allocator with state
1.825 + * as those allocators might have implement a special swap function to correctly
1.826 + * move datas from an instance to the oher, _STLP_alloc_proxy should not break
1.827 + * this mecanism. */
1.828 + void swap(_Self& __x) {
1.829 + _M_swap_alloc(__x);
1.830 + _STLP_STD::swap(_M_data, __x._M_data);
1.831 + }
1.832 +
1.833 + _Tp* allocate(size_type __n, size_type& __allocated_n) {
1.834 +#if !defined (__BORLANDC__)
1.835 + typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
1.836 +#else
1.837 + typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
1.838 +#endif
1.839 + return allocate(__n, __allocated_n, _STLportAlloc());
1.840 + }
1.841 +
1.842 // Unified interface to perform allocate()/deallocate() with limited
1.843 // language support
1.844 -#if ! defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM)
1.845 +#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
1.846 // else it is rebound already, and allocate() member is accessible
1.847 - inline _Tp* allocate(size_t __n) {
1.848 - return __stl_alloc_rebind(__STATIC_CAST(_Base&,*this),(_Tp*)0).allocate(__n,0);
1.849 - }
1.850 - inline void deallocate(_Tp* __p, size_t __n) {
1.851 - __stl_alloc_rebind(__STATIC_CAST(_Base&, *this),(_Tp*)0).deallocate(__p, __n);
1.852 - }
1.853 -#endif /* !_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
1.854 + _Tp* allocate(size_type __n)
1.855 + { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
1.856 + void deallocate(_Tp* __p, size_type __n)
1.857 + { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
1.858 +private:
1.859 + _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
1.860 + { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, __allocated_n); }
1.861 +#else
1.862 + //Expose Standard allocate overload (using expression do not work for some compilers (Borland))
1.863 + _Tp* allocate(size_type __n)
1.864 + { return _Base::allocate(__n); }
1.865 +private:
1.866 + _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
1.867 + { return _Base::allocate(__n, __allocated_n); }
1.868 +#endif
1.869 +
1.870 + _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
1.871 + { __allocated_n = __n; return allocate(__n); }
1.872 };
1.873
1.874 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.875 -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char *,char,allocator<char> >;
1.876 +#if defined (_STLP_USE_TEMPLATE_EXPORT)
1.877 +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
1.878 # if defined (_STLP_HAS_WCHAR_T)
1.879 -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t *,wchar_t,allocator<wchar_t> >;
1.880 +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
1.881 # endif
1.882 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.883 +# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.884 +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
1.885 +# endif
1.886 +#endif
1.887
1.888 -# undef _STLP_NODE_ALLOCATOR_THREADS
1.889 -
1.890 +_STLP_MOVE_TO_STD_NAMESPACE
1.891 _STLP_END_NAMESPACE
1.892
1.893 -# if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
1.894 +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
1.895 # include <stl/_alloc.c>
1.896 -# endif
1.897 +#endif
1.898
1.899 #endif /* _STLP_INTERNAL_ALLOC_H */
1.900