42 #ifndef _DEBUG_ALLOCATOR_H 
   43 #define _DEBUG_ALLOCATOR_H 1 
   49 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 
   51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   61   template<
typename _Alloc>
 
   69       typedef typename _Traits::size_type           size_type;
 
   70       typedef typename _Traits::difference_type difference_type;
 
   71       typedef typename _Traits::pointer         pointer;
 
   72       typedef typename _Traits::const_pointer    const_pointer;
 
   73       typedef typename _Traits::reference           reference;
 
   74       typedef typename _Traits::const_reference  const_reference;
 
   75       typedef typename _Traits::value_type       value_type;
 
   77       template<
typename _Up>
 
   93       template<
typename _Alloc2,
 
   98       template<
typename _Alloc2>
 
   99     struct __convertible<_Alloc2, _Alloc>
 
  101       typedef void* __type;
 
  106     const size_t __obj_size = 
sizeof(value_type);
 
  107     return (
sizeof(size_type) + __obj_size - 1) / __obj_size; 
 
  113       template<
typename _Alloc2>
 
  115             typename __convertible<_Alloc2>::__type = 0)
 
  116     : _M_allocator(__a2._M_allocator), _M_extra(_S_extra()) { }
 
  119       : _M_allocator(__a), _M_extra(_S_extra()) { }
 
  122       allocate(size_type __n)
 
  124         pointer __res = _M_allocator.allocate(__n + _M_extra);      
 
  125     size_type* __ps = 
reinterpret_cast<size_type*
>(__res);
 
  127         return __res + _M_extra;
 
  131       allocate(size_type __n, 
const void* __hint)
 
  133         pointer __res = _M_allocator.allocate(__n + _M_extra, __hint);
 
  134     size_type* __ps = 
reinterpret_cast<size_type*
>(__res);
 
  136         return __res + _M_extra;
 
  140       deallocate(pointer __p, size_type __n)
 
  142     using std::__throw_runtime_error;
 
  145         pointer __real_p = __p - _M_extra;
 
  146         if (*reinterpret_cast<size_type*>(__real_p) != __n)
 
  147           __throw_runtime_error(
"debug_allocator::deallocate wrong size");
 
  148         _M_allocator.deallocate(__real_p, __n + _M_extra);
 
  151       __throw_runtime_error(
"debug_allocator::deallocate null pointer");
 
  155       construct(pointer __p, 
const value_type& __val)
 
  156       { _Traits::construct(_M_allocator, __p, __val); }
 
  158 #if __cplusplus >= 201103L 
  159       template<
typename _Tp, 
typename... _Args>
 
  161     construct(_Tp* __p, _Args&&... __args)
 
  163       _Traits::construct(_M_allocator, __p,
 
  164                  std::forward<_Args>(__args)...);
 
  168       template<
typename _Tp>
 
  171     { _Traits::destroy(_M_allocator, __p); }
 
  174       max_size() 
const throw()
 
  179       { 
return __lhs._M_allocator == __rhs._M_allocator; }
 
  182   template<
typename _Alloc>
 
  186     { 
return !(__lhs == __rhs); }
 
  188 _GLIBCXX_END_NAMESPACE_VERSION
 
Uniform interface to C++98 and C++0x allocators. 
GNU extensions for public use. 
A meta-allocator with debugging bits.This is precisely the allocator defined in the C++03 Standard...
static size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.