epoc32/include/stdapis/stlport/stl/_alloc.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_alloc.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,543 +0,0 @@
     1.4 -/*
     1.5 - *
     1.6 - * Copyright (c) 1996,1997
     1.7 - * Silicon Graphics Computer Systems, Inc.
     1.8 - *
     1.9 - * Copyright (c) 1997
    1.10 - * Moscow Center for SPARC Technology
    1.11 - *
    1.12 - * Copyright (c) 1999 
    1.13 - * Boris Fomitchev
    1.14 - *
    1.15 - * This material is provided "as is", with absolutely no warranty expressed
    1.16 - * or implied. Any use is at your own risk.
    1.17 - *
    1.18 - * Permission to use or copy this software for any purpose is hereby granted 
    1.19 - * without fee, provided the above notices are retained on all copies.
    1.20 - * Permission to modify the code and to distribute modified code is granted,
    1.21 - * provided the above notices are retained, and a notice that the code was
    1.22 - * modified is included with the above copyright notice.
    1.23 - *
    1.24 - */
    1.25 -
    1.26 -/* NOTE: This is an internal header file, included by other STL headers.
    1.27 - *   You should not attempt to use it directly.
    1.28 - */
    1.29 -
    1.30 -#ifndef _STLP_INTERNAL_ALLOC_H
    1.31 -#define _STLP_INTERNAL_ALLOC_H
    1.32 -
    1.33 -# ifndef _STLP_CSTDDEF
    1.34 -#  include <cstddef>
    1.35 -# endif
    1.36 -
    1.37 -#if !defined (_STLP_DEBUG_H) && (defined  (_STLP_DEBUG) || defined (_STLP_ASSERTIONS))
    1.38 -# include <stl/debug/_debug.h>
    1.39 -#endif
    1.40 -
    1.41 -# ifndef _STLP_CSTDLIB
    1.42 -#  include <cstdlib>
    1.43 -# endif
    1.44 -# ifndef _STLP_CSTRING
    1.45 -#  include <cstring>
    1.46 -# endif
    1.47 -
    1.48 -# ifndef __THROW_BAD_ALLOC
    1.49 -#  if !defined(_STLP_USE_EXCEPTIONS)
    1.50 -#   if !defined (_STLP_CSTDIO)
    1.51 -#    include <cstdio>
    1.52 -#   endif
    1.53 -#   if !defined (_STLP_CSTDLIB)
    1.54 -#    include <cstdlib>
    1.55 -#   endif
    1.56 -#   define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
    1.57 -#  else /* !defined(_STLP_USE_EXCEPTIONS) */
    1.58 -#   define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc()
    1.59 -#  endif /* !defined(_STLP_USE_EXCEPTIONS) */
    1.60 -# endif   /* __THROW_BAD_ALLOC */
    1.61 -
    1.62 -# ifndef _STLP_INTERNAL_NEW_HEADER
    1.63 -#  include <stl/_new.h>
    1.64 -# endif
    1.65 -
    1.66 -// #if ! defined (__SYMBIAN32__)
    1.67 -#if /* defined (_STLP_THREADS) && */ ! defined (_STLP_INTERNAL_THREADS_H)
    1.68 -# include <stl/_threads.h>
    1.69 -// #endif
    1.70 -#endif
    1.71 -
    1.72 -#ifndef _STLP_INTERNAL_CONSTRUCT_H
    1.73 -# include <stl/_construct.h>
    1.74 -#endif
    1.75 -
    1.76 -#ifndef __ALLOC
    1.77 -#   define __ALLOC __sgi_alloc
    1.78 -#endif
    1.79 -
    1.80 -# ifndef __RESTRICT
    1.81 -#  define __RESTRICT
    1.82 -# endif
    1.83 -
    1.84 -#if defined (_STLP_THREADS) || (defined(_STLP_OWN_IOSTREAMS) && ! defined (_STLP_NO_THREADS) && ! defined (_NOTHREADS) )
    1.85 -# define _STLP_NODE_ALLOCATOR_THREADS true
    1.86 -#else
    1.87 -# define _STLP_NODE_ALLOCATOR_THREADS false
    1.88 -#endif
    1.89 -
    1.90 -_STLP_BEGIN_NAMESPACE
    1.91 -
    1.92 -# if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
    1.93 -template <class _Tp, class _Alloc> struct __allocator;
    1.94 -# endif
    1.95 -
    1.96 -#ifndef _STLP_NO_NODE_ALLOC
    1.97 -
    1.98 -// Malloc-based allocator.  Typically slower than default alloc below.
    1.99 -// Typically thread-safe and more storage efficient.
   1.100 -
   1.101 -typedef void (* __oom_handler_type)();
   1.102 -
   1.103 -template <int __inst>
   1.104 -class __malloc_alloc {
   1.105 -private:
   1.106 -  static void* _STLP_CALL _S_oom_malloc(size_t);
   1.107 -  static __oom_handler_type __oom_handler;
   1.108 -public:
   1.109 -  // this one is needed for proper simple_alloc wrapping
   1.110 -  typedef char value_type;
   1.111 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
   1.112 -  template <class _Tp1> struct rebind {
   1.113 -    typedef __allocator<_Tp1, __malloc_alloc<__inst> > other;
   1.114 -  };
   1.115 -# endif
   1.116 -  static void* _STLP_CALL allocate(size_t __n)    {
   1.117 -    void* __result = malloc(__n);
   1.118 -    if (0 == __result) __result = _S_oom_malloc(__n);
   1.119 -    return __result;
   1.120 -  }
   1.121 -  static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
   1.122 -  static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f) {
   1.123 -    __oom_handler_type __old = __oom_handler;
   1.124 -    __oom_handler = __f;
   1.125 -    return(__old);
   1.126 -  }
   1.127 -};
   1.128 -
   1.129 -# endif
   1.130 -
   1.131 -// New-based allocator.  Typically slower than default alloc below.
   1.132 -// Typically thread-safe and more storage efficient.
   1.133 -class _STLP_CLASS_DECLSPEC __new_alloc {
   1.134 -public:
   1.135 -  // this one is needed for proper simple_alloc wrapping
   1.136 -  typedef char value_type;
   1.137 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) &&  defined(_STLP_USE_RAW_SGI_ALLOCATORS)
   1.138 -  template <class _Tp1> struct rebind {
   1.139 -    typedef __allocator<_Tp1, __new_alloc > other;
   1.140 -  };
   1.141 -# endif
   1.142 -  static void* _STLP_CALL  allocate(size_t __n) {  
   1.143 -    return __stl_new(__n); 
   1.144 -  }
   1.145 -  static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
   1.146 -};
   1.147 -
   1.148 -
   1.149 -// Allocator adaptor to check size arguments for debugging.
   1.150 -// Reports errors using assert.  Checking can be disabled with
   1.151 -// NDEBUG, but it's far better to just use the underlying allocator
   1.152 -// instead when no checking is desired.
   1.153 -// There is some evidence that this can confuse Purify.
   1.154 -// This adaptor can only be applied to raw allocators
   1.155 -
   1.156 -template <class _Alloc>
   1.157 -class __debug_alloc : public _Alloc {
   1.158 -public:
   1.159 -  typedef _Alloc __allocator_type;
   1.160 -  typedef typename _Alloc::value_type value_type;
   1.161 -private:
   1.162 -  struct __alloc_header {
   1.163 -    size_t __magic: 16;
   1.164 -    size_t __type_size:16;
   1.165 -    _STLP_UINT32_T _M_size;
   1.166 -  }; // that is 8 bytes for sure
   1.167 -  // Sunpro CC has bug on enums, so extra_before/after set explicitly
   1.168 -  enum { __pad=8, __magic=0xdeba, __deleted_magic = 0xdebd,
   1.169 -	 __shred_byte= _STLP_SHRED_BYTE
   1.170 -  };
   1.171 -
   1.172 -  enum { __extra_before = 16, __extra_after = 8 };
   1.173 -  // Size of space used to store size.  Note
   1.174 -  // that this must be large enough to preserve
   1.175 -  // alignment.
   1.176 -  static size_t _STLP_CALL __extra_before_chunk() {
   1.177 -    return (long)__extra_before/sizeof(value_type)+
   1.178 -      (size_t)((long)__extra_before%sizeof(value_type)>0);
   1.179 -  }
   1.180 -  static size_t _STLP_CALL __extra_after_chunk() {
   1.181 -    return (long)__extra_after/sizeof(value_type)+
   1.182 -      (size_t)((long)__extra_after%sizeof(value_type)>0);
   1.183 -  }
   1.184 -public:
   1.185 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
   1.186 -  template <class _Tp1> struct rebind {
   1.187 -    typedef __allocator< _Tp1, __debug_alloc<_Alloc> > other;
   1.188 -  };
   1.189 -# endif
   1.190 -  __debug_alloc() {}
   1.191 -  ~__debug_alloc() {}
   1.192 -  static void * _STLP_CALL allocate(size_t);
   1.193 -  static void _STLP_CALL deallocate(void *, size_t);
   1.194 -};
   1.195 -
   1.196 -# if defined(__OS400__)
   1.197 -enum {_ALIGN = 16, _ALIGN_SHIFT=4, _MAX_BYTES = 256};
   1.198 -#  define  _STLP_NFREELISTS 16
   1.199 -# else
   1.200 -enum {_ALIGN = 8, _ALIGN_SHIFT=3, _MAX_BYTES = 128};
   1.201 -#  define  _STLP_NFREELISTS 16
   1.202 -# endif /* __OS400__ */
   1.203 -
   1.204 -#ifndef _STLP_NO_NODE_ALLOC
   1.205 -
   1.206 -// Default node allocator.
   1.207 -// With a reasonable compiler, this should be roughly as fast as the
   1.208 -// original STL class-specific allocators, but with less fragmentation.
   1.209 -// Default_alloc_template parameters are experimental and MAY
   1.210 -// DISAPPEAR in the future.  Clients should just use alloc for now.
   1.211 -//
   1.212 -// Important implementation properties:
   1.213 -// 1. If the client request an object of size > _MAX_BYTES, the resulting
   1.214 -//    object will be obtained directly from malloc.
   1.215 -// 2. In all other cases, we allocate an object of size exactly
   1.216 -//    _S_round_up(requested_size).  Thus the client has enough size
   1.217 -//    information that we can return the object to the proper free list
   1.218 -//    without permanently losing part of the object.
   1.219 -//
   1.220 -
   1.221 -// The first template parameter specifies whether more than one thread
   1.222 -// may use this allocator.  It is safe to allocate an object from
   1.223 -// one instance of a default_alloc and deallocate it with another
   1.224 -// one.  This effectively transfers its ownership to the second one.
   1.225 -// This may have undesirable effects on reference locality.
   1.226 -// The second parameter is unreferenced and serves only to allow the
   1.227 -// creation of multiple default_alloc instances.
   1.228 -
   1.229 -class _STLP_CLASS_DECLSPEC _Node_alloc_obj {
   1.230 -public:
   1.231 -    _Node_alloc_obj * _M_free_list_link;
   1.232 -};
   1.233 -
   1.234 -template <bool __threads, int __inst>
   1.235 -class __node_alloc {
   1.236 -  _STLP_PRIVATE:
   1.237 -  static inline size_t _STLP_CALL _S_round_up(size_t __bytes) { return (((__bytes) + (size_t)_ALIGN-1) & ~((size_t)_ALIGN - 1)); }
   1.238 -  typedef _Node_alloc_obj _Obj;
   1.239 -private:
   1.240 -  // Returns an object of size __n, and optionally adds to size __n free list.
   1.241 -  static void*  _STLP_CALL _S_refill(size_t __n);
   1.242 -  // Allocates a chunk for nobjs of size size.  nobjs may be reduced
   1.243 -  // if it is inconvenient to allocate the requested number.
   1.244 -  static char*  _STLP_CALL _S_chunk_alloc(size_t __p_size, int& __nobjs);
   1.245 -  // Chunk allocation state.
   1.246 -  static _Node_alloc_obj * _STLP_VOLATILE _S_free_list[_STLP_NFREELISTS]; 
   1.247 -  static char* _S_start_free;
   1.248 -  static char* _S_end_free;
   1.249 -  static size_t _S_heap_size;
   1.250 -  static void * _STLP_CALL _M_allocate(size_t __n);
   1.251 -  /* __p may not be 0 */
   1.252 -  static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
   1.253 -public:
   1.254 -  // this one is needed for proper simple_alloc wrapping
   1.255 -  typedef char value_type;
   1.256 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
   1.257 -  template <class _Tp1> struct rebind {
   1.258 -    typedef __allocator<_Tp1, __node_alloc<__threads, __inst> > other;
   1.259 -  };
   1.260 -# endif
   1.261 -  /* __n must be > 0      */
   1.262 -  static void * _STLP_CALL allocate(size_t __n) { 
   1.263 -return (__n > (size_t)_MAX_BYTES) ?  __stl_new(__n) : _M_allocate(__n); }
   1.264 -  /* __p may not be 0 */
   1.265 -  static void _STLP_CALL deallocate(void *__p, size_t __n) { 
   1.266 -if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
   1.267 -};
   1.268 -
   1.269 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.270 -_STLP_EXPORT_TEMPLATE_CLASS __malloc_alloc<0>;
   1.271 -_STLP_EXPORT_TEMPLATE_CLASS __node_alloc<_STLP_NODE_ALLOCATOR_THREADS, 0>;
   1.272 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.273 -typedef __node_alloc<_STLP_NODE_ALLOCATOR_THREADS, 0> _Node_alloc;
   1.274 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.275 -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<_Node_alloc>;
   1.276 -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
   1.277 -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc<0> >;
   1.278 -# endif
   1.279 -
   1.280 -#endif
   1.281 -
   1.282 -# if defined (_STLP_USE_PERTHREAD_ALLOC)
   1.283 -
   1.284 -_STLP_END_NAMESPACE
   1.285 -// include additional header here
   1.286 -# include <stl/_pthread_alloc.h>
   1.287 -_STLP_BEGIN_NAMESPACE
   1.288 -
   1.289 -#  if defined ( _STLP_DEBUG_ALLOC )
   1.290 -typedef __debug_alloc<__pthread_alloc> __sgi_alloc;
   1.291 -#  else
   1.292 -typedef __pthread_alloc __sgi_alloc;
   1.293 -#  endif /* _STLP_DEBUG_ALLOC */
   1.294 -
   1.295 -typedef __pthread_alloc __single_client_alloc;
   1.296 -typedef __pthread_alloc __multithreaded_alloc;
   1.297 -
   1.298 -# else
   1.299 -
   1.300 -# if defined ( _STLP_USE_NEWALLOC )
   1.301 -
   1.302 -#  if defined ( _STLP_DEBUG_ALLOC )
   1.303 -typedef __debug_alloc<__new_alloc> __sgi_alloc;
   1.304 -#  else
   1.305 -typedef __new_alloc __sgi_alloc;
   1.306 -#  endif /* _STLP_DEBUG_ALLOC */
   1.307 -
   1.308 -typedef __new_alloc __single_client_alloc;
   1.309 -typedef __new_alloc __multithreaded_alloc;
   1.310 -
   1.311 -#  elif defined (_STLP_USE_MALLOC)
   1.312 -
   1.313 -#   if defined ( _STLP_DEBUG_ALLOC )
   1.314 -typedef __debug_alloc<__malloc_alloc<0> > __sgi_alloc;
   1.315 -#   else
   1.316 -typedef __malloc_alloc<0> __sgi_alloc;
   1.317 -#   endif /* _STLP_DEBUG_ALLOC */
   1.318 -
   1.319 -typedef __malloc_alloc<0> __single_client_alloc;
   1.320 -typedef __malloc_alloc<0> __multithreaded_alloc;
   1.321 -
   1.322 -# else
   1.323 -
   1.324 -#   if defined ( _STLP_DEBUG_ALLOC )
   1.325 -typedef __debug_alloc<_Node_alloc> __sgi_alloc;
   1.326 -#   else
   1.327 -typedef _Node_alloc __sgi_alloc;
   1.328 -#   endif
   1.329 -
   1.330 -typedef __node_alloc<false, 0> __single_client_alloc;
   1.331 -typedef __node_alloc<true, 0>  __multithreaded_alloc;
   1.332 -
   1.333 -#  endif /* _STLP_USE_NEWALLOC */
   1.334 -# endif /* PTHREAD_ALLOC */
   1.335 -
   1.336 -// This implements allocators as specified in the C++ standard.  
   1.337 -//
   1.338 -// Note that standard-conforming allocators use many language features
   1.339 -// that are not yet widely implemented.  In particular, they rely on
   1.340 -// member templates, partial specialization, partial ordering of function
   1.341 -// templates, the typename keyword, and the use of the template keyword
   1.342 -// to refer to a template member of a dependent type.
   1.343 -
   1.344 -template <class _Tp>
   1.345 -class allocator {
   1.346 -public:
   1.347 -
   1.348 -  typedef _Tp        value_type;
   1.349 -  typedef value_type *       pointer;
   1.350 -  typedef const _Tp* const_pointer;
   1.351 -  typedef _Tp&       reference;
   1.352 -  typedef const _Tp& const_reference;
   1.353 -  typedef size_t     size_type;
   1.354 -  typedef ptrdiff_t  difference_type;
   1.355 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
   1.356 -  template <class _Tp1> struct rebind {
   1.357 -    typedef allocator<_Tp1> other;
   1.358 -  };
   1.359 -# endif
   1.360 -  allocator() _STLP_NOTHROW {}
   1.361 - # if defined (_STLP_MEMBER_TEMPLATES)
   1.362 -  template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
   1.363 - # endif    
   1.364 -  allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
   1.365 -  ~allocator() _STLP_NOTHROW {}
   1.366 -  pointer address(reference __x) const { return &__x; }
   1.367 -  const_pointer address(const_reference __x) const { return &__x; }
   1.368 -  // __n is permitted to be 0.  The C++ standard says nothing about what the return value is when __n == 0.
   1.369 -  _Tp* allocate(size_type __n, const void* = 0) { 
   1.370 -    return __n != 0 ? __REINTERPRET_CAST(value_type*,__sgi_alloc::allocate(__n * sizeof(value_type))) : 0;
   1.371 -  }
   1.372 -  // __p is permitted to be a null pointer, only if n==0.
   1.373 -  void deallocate(pointer __p, size_type __n) {
   1.374 -    _STLP_ASSERT( (__p == 0) == (__n == 0) )
   1.375 -      if (__p != 0) __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
   1.376 -  }
   1.377 -  // backwards compatibility
   1.378 -  void deallocate(pointer __p) const {  if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
   1.379 -  size_type max_size() const _STLP_NOTHROW  { return size_t(-1) / sizeof(value_type); }
   1.380 -  void construct(pointer __p, const _Tp& __val) { _STLP_STD::_Construct(__p, __val); }
   1.381 -  void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
   1.382 -# if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))
   1.383 -  template <class _T2> bool operator==(const allocator<_T2>&) const  _STLP_NOTHROW { return true; }
   1.384 -  template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
   1.385 -# endif
   1.386 -};
   1.387 -
   1.388 -_STLP_TEMPLATE_NULL
   1.389 -class _STLP_CLASS_DECLSPEC allocator<void> {
   1.390 -public:
   1.391 -  typedef size_t      size_type;
   1.392 -  typedef ptrdiff_t   difference_type;
   1.393 -  typedef void*       pointer;
   1.394 -  typedef const void* const_pointer;
   1.395 -# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
   1.396 -  typedef void        value_type;
   1.397 -# endif
   1.398 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
   1.399 -  template <class _Tp1> struct rebind {
   1.400 -    typedef allocator<_Tp1> other;
   1.401 -  };
   1.402 -# endif
   1.403 -# if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))		//*ty 03/24/2001 - MPW compilers get confused on these operator definitions
   1.404 -  template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
   1.405 -  template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
   1.406 -# endif
   1.407 -};
   1.408 -
   1.409 -#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)))		//*ty 03/24/2001 - MPW compilers get confused on these operator definitions
   1.410 -template <class _T1, class _T2> inline bool  _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return true; }
   1.411 -template <class _T1, class _T2> inline bool  _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return false; }
   1.412 -#endif
   1.413 -
   1.414 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.415 -_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
   1.416 -#  if defined (_STLP_HAS_WCHAR_T)
   1.417 -_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
   1.418 -#  endif
   1.419 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.420 -
   1.421 -// Another allocator adaptor: _Alloc_traits.  This serves two
   1.422 -// purposes.  First, make it possible to write containers that can use
   1.423 -// either SGI-style allocators or standard-conforming allocator.
   1.424 -
   1.425 -// The fully general version.
   1.426 -template <class _Tp, class _Allocator>
   1.427 -struct _Alloc_traits
   1.428 -{
   1.429 -  typedef _Allocator _Orig;
   1.430 -# if defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM) 
   1.431 -  typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
   1.432 -  typedef typename _Rebind_type::other  allocator_type;
   1.433 -  static allocator_type create_allocator(const _Orig& __a) { return allocator_type(__a); }
   1.434 -# else
   1.435 -  // this is not actually true, used only to pass this type through
   1.436 -  // to dynamic overload selection in _STLP_alloc_proxy methods
   1.437 -  typedef _Allocator allocator_type;
   1.438 -# endif /* _STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
   1.439 -};
   1.440 -
   1.441 -#ifndef _STLP_FORCE_ALLOCATORS
   1.442 -#define _STLP_FORCE_ALLOCATORS(a,y) 
   1.443 -#endif
   1.444 -
   1.445 -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (_STLP_MEMBER_TEMPLATE_CLASSES)
   1.446 -// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
   1.447 -template <class _Tp, class _Tp1>
   1.448 -struct _Alloc_traits<_Tp, allocator<_Tp1> > {
   1.449 -  typedef allocator<_Tp1> _Orig;
   1.450 -  typedef allocator<_Tp> allocator_type;
   1.451 -  static allocator_type create_allocator(const allocator<_Tp1 >& __a) { return allocator_type(__a); }
   1.452 -};
   1.453 -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   1.454 -
   1.455 -/* macro to convert the allocator for initialization
   1.456 - * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor  */
   1.457 -#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
   1.458 -/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
   1.459 - * not used implicitly to convert allocator parameter, so let us do it explicitly */
   1.460 -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
   1.461 -#  define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
   1.462 -# else
   1.463 -#  define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
   1.464 -# endif
   1.465 -/* else convert, but only if partial specialization works, since else
   1.466 - * Container::allocator_type won't be different */
   1.467 -#else 
   1.468 -#  define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
   1.469 -#endif
   1.470 -
   1.471 -# if defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM) 
   1.472 -template <class _Tp, class _Alloc>
   1.473 -inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type  _STLP_CALL
   1.474 -__stl_alloc_create(const _Alloc& __a, const _Tp*) {
   1.475 -  typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
   1.476 -  return _Rebound_type(__a);
   1.477 -}
   1.478 -#else
   1.479 -// If custom allocators are being used without member template classes support :
   1.480 -// user (on purpose) is forced to define rebind/get operations !!!
   1.481 -template <class _Tp1, class _Tp2>
   1.482 -inline allocator<_Tp2>& _STLP_CALL
   1.483 -__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) {  return (allocator<_Tp2>&)(__a); }
   1.484 -template <class _Tp1, class _Tp2>
   1.485 -inline allocator<_Tp2> _STLP_CALL
   1.486 -__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
   1.487 -#endif /* _STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
   1.488 -
   1.489 -# ifdef _STLP_USE_RAW_SGI_ALLOCATORS
   1.490 -// move obsolete stuff out of the way
   1.491 -# include <stl/_alloc_old.h>
   1.492 -# endif
   1.493 -
   1.494 -// inheritance is being used for EBO optimization
   1.495 -template <class _Value, class _Tp, class _MaybeReboundAlloc>
   1.496 -class _STLP_alloc_proxy : public _MaybeReboundAlloc {
   1.497 -private:
   1.498 -  typedef _MaybeReboundAlloc _Base;
   1.499 -  typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
   1.500 -public:
   1.501 -  _Value _M_data;
   1.502 -  inline _STLP_alloc_proxy(const _MaybeReboundAlloc& __a, _Value __p) : _MaybeReboundAlloc(__a), _M_data(__p) {}
   1.503 -
   1.504 -# if 0
   1.505 -  inline _STLP_alloc_proxy(const _Self& __x) : _MaybeReboundAlloc(__x), _M_data(__x._M_data) {} 
   1.506 -  // construction/destruction
   1.507 -  inline _Self& operator = (const _Self& __x) { 
   1.508 -    *(_MaybeReboundAlloc*)this = *(_MaybeReboundAlloc*)__x;
   1.509 -    _M_data = __x._M_data; return *this; 
   1.510 -  } 
   1.511 -  inline _Self& operator = (const _Base& __x) { ((_Base&)*this) = __x; return *this; } 
   1.512 -# endif
   1.513 -  // Unified interface to perform allocate()/deallocate() with limited
   1.514 -  // language support
   1.515 -#if ! defined (_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM)
   1.516 -  // else it is rebound already, and allocate() member is accessible
   1.517 -  inline _Tp* allocate(size_t __n) { 
   1.518 -    return __stl_alloc_rebind(__STATIC_CAST(_Base&,*this),(_Tp*)0).allocate(__n,0); 
   1.519 -  }
   1.520 -  inline void deallocate(_Tp* __p, size_t __n) { 
   1.521 -    __stl_alloc_rebind(__STATIC_CAST(_Base&, *this),(_Tp*)0).deallocate(__p, __n); 
   1.522 -  }
   1.523 -#endif /* !_STLP_USE_NESTED_TCLASS_THROUGHT_TPARAM */
   1.524 -};
   1.525 -
   1.526 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.527 -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char *,char,allocator<char> >;
   1.528 -#  if defined (_STLP_HAS_WCHAR_T)
   1.529 -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t *,wchar_t,allocator<wchar_t> >;
   1.530 -#  endif
   1.531 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.532 -
   1.533 -# undef _STLP_NODE_ALLOCATOR_THREADS
   1.534 -
   1.535 -_STLP_END_NAMESPACE
   1.536 -
   1.537 -# if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
   1.538 -#  include <stl/_alloc.c>
   1.539 -# endif
   1.540 -
   1.541 -#endif /* _STLP_INTERNAL_ALLOC_H */
   1.542 -
   1.543 -// Local Variables:
   1.544 -// mode:C++
   1.545 -// End:
   1.546 -