30 #ifndef _ARRAY_ALLOCATOR_H 
   31 #define _ARRAY_ALLOCATOR_H 1 
   39 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 
   41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   47  template<
typename _Tp>
 
   51       typedef size_t        size_type;
 
   52       typedef ptrdiff_t     difference_type;
 
   54       typedef const _Tp*    const_pointer;
 
   55       typedef _Tp&          reference;
 
   56       typedef const _Tp&    const_reference;
 
   57       typedef _Tp           value_type;
 
   60       address(reference __x) 
const _GLIBCXX_NOEXCEPT
 
   64       address(const_reference __x) 
const _GLIBCXX_NOEXCEPT
 
   68       deallocate(pointer, size_type)
 
   74       max_size() 
const _GLIBCXX_USE_NOEXCEPT 
 
   75       { 
return size_t(-1) / 
sizeof(_Tp); }
 
   77 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
   78       template<
typename _Up, 
typename... _Args>
 
   80         construct(_Up* __p, _Args&&... __args)
 
   81     { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
 
   83       template<
typename _Up>
 
   85         destroy(_Up* __p) { __p->~_Up(); }
 
   90       construct(pointer __p, 
const _Tp& __val) 
 
   91       { ::new((
void *)__p) value_type(__val); }
 
   94       destroy(pointer __p) { __p->~_Tp(); }
 
  103   template<
typename _Tp, 
typename _Array = std::tr1::array<_Tp, 1> >
 
  107       typedef size_t        size_type;
 
  108       typedef ptrdiff_t     difference_type;
 
  109       typedef _Tp*          pointer;
 
  110       typedef const _Tp*    const_pointer;
 
  111       typedef _Tp&          reference;
 
  112       typedef const _Tp&    const_reference;
 
  113       typedef _Tp           value_type;
 
  114       typedef _Array        array_type;
 
  117       array_type*   _M_array;
 
  121      template<
typename _Tp1, 
typename _Array1 = _Array>
 
  125       array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT 
 
  126       : _M_array(__array), _M_used(size_type()) { }
 
  128       array_allocator(
const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT 
 
  129       : _M_array(__o._M_array), _M_used(__o._M_used) { }
 
  131       template<
typename _Tp1, 
typename _Array1>
 
  132         array_allocator(
const array_allocator<_Tp1, _Array1>&)
 
  133     _GLIBCXX_USE_NOEXCEPT
 
  134     : _M_array(0), _M_used(size_type()) { }
 
  136       ~array_allocator() _GLIBCXX_USE_NOEXCEPT { }
 
  139       allocate(size_type __n, 
const void* = 0)
 
  141     if (_M_array == 0 || _M_used + __n > _M_array->size())
 
  142       std::__throw_bad_alloc();
 
  143     pointer __ret = _M_array->begin() + _M_used;
 
  149   template<
typename _Tp, 
typename _Array>
 
  151     operator==(
const array_allocator<_Tp, _Array>&,
 
  152            const array_allocator<_Tp, _Array>&)
 
  155   template<
typename _Tp, 
typename _Array>
 
  157     operator!=(
const array_allocator<_Tp, _Array>&, 
 
  158            const array_allocator<_Tp, _Array>&)
 
  161 _GLIBCXX_END_NAMESPACE_VERSION
 
An allocator that uses previously allocated memory. This memory can be externally, globally, or otherwise allocated. 
 
_Tp * __addressof(_Tp &__r) _GLIBCXX_NOEXCEPT
Same as C++11 std::addressof.