ReactOS  0.4.13-dev-563-g0561610
allocator< _Tp > Class Template Reference

#include <_alloc.h>

Inheritance diagram for allocator< _Tp >:
Collaboration diagram for allocator< _Tp >:

Public Types

typedef _Tp value_type
 
typedef _Tp * pointer
 
typedef const _Tp * const_pointer
 
typedef _Tp & reference
 
typedef const _Tp & const_reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
- Public Types inherited from __stlport_class< allocator< _Tp > >
typedef allocator< _Tp > _Type
 

Public Member Functions

 allocator () _STLP_NOTHROW
 
 allocator (const allocator< _Tp > &) _STLP_NOTHROW
 
 allocator (__move_source< allocator< _Tp > > src) _STLP_NOTHROW
 
 ~allocator () _STLP_NOTHROW
 
pointer address (reference __x) const
 
const_pointer address (const_reference __x) const
 
_Tp * allocate (size_type __n, const void *=0)
 
void deallocate (pointer __p, size_type __n)
 
void deallocate (pointer __p) const
 
size_type max_size () const _STLP_NOTHROW
 
void construct (pointer __p, const_reference __val)
 
void destroy (pointer __p)
 
_Tp * _M_allocate (size_type __n, size_type &__allocated_n)
 

Detailed Description

template<class _Tp>
class allocator< _Tp >

Definition at line 270 of file _alloc.h.

Member Typedef Documentation

◆ const_pointer

template<class _Tp>
typedef const _Tp* allocator< _Tp >::const_pointer

Definition at line 279 of file _alloc.h.

◆ const_reference

template<class _Tp>
typedef const _Tp& allocator< _Tp >::const_reference

Definition at line 281 of file _alloc.h.

◆ difference_type

template<class _Tp>
typedef ptrdiff_t allocator< _Tp >::difference_type

Definition at line 283 of file _alloc.h.

◆ pointer

template<class _Tp>
typedef _Tp* allocator< _Tp >::pointer

Definition at line 278 of file _alloc.h.

◆ reference

template<class _Tp>
typedef _Tp& allocator< _Tp >::reference

Definition at line 280 of file _alloc.h.

◆ size_type

template<class _Tp>
typedef size_t allocator< _Tp >::size_type

Definition at line 282 of file _alloc.h.

◆ value_type

template<class _Tp>
typedef _Tp allocator< _Tp >::value_type

Definition at line 277 of file _alloc.h.

Constructor & Destructor Documentation

◆ allocator() [1/3]

template<class _Tp>
allocator< _Tp >::allocator ( )
inline

Definition at line 289 of file _alloc.h.

289 {}

◆ allocator() [2/3]

template<class _Tp>
allocator< _Tp >::allocator ( const allocator< _Tp > &  )
inline

Definition at line 293 of file _alloc.h.

293 {}

◆ allocator() [3/3]

template<class _Tp>
allocator< _Tp >::allocator ( __move_source< allocator< _Tp > >  src)
inline

Definition at line 295 of file _alloc.h.

295 {}

◆ ~allocator()

template<class _Tp>
allocator< _Tp >::~allocator ( )
inline

Definition at line 297 of file _alloc.h.

297 {}

Member Function Documentation

◆ _M_allocate()

template<class _Tp>
_Tp* allocator< _Tp >::_M_allocate ( size_type  __n,
size_type __allocated_n 
)
inline

Definition at line 341 of file _alloc.h.

341  {
342  if (__n > max_size()) {
344  }
345 
346  if (__n != 0) {
347  size_type __buf_size = __n * sizeof(value_type);
348  _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
349 #if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
350  memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
351 #endif
352  __allocated_n = __buf_size / sizeof(value_type);
353  return __ret;
354  }
355 
356  return 0;
357  }
return __n
Definition: _algo.h:75
size_t size_type
Definition: _alloc.h:282
static void *_STLP_CALL allocate(size_t &__n)
Definition: _alloc.h:157
#define _STLP_SHRED_BYTE
Definition: features.h:903
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
size_type max_size() const _STLP_NOTHROW
Definition: _alloc.h:330
_Tp value_type
Definition: _alloc.h:277
#define memset(x, y, z)
Definition: compat.h:39
#define _STLP_THROW_BAD_ALLOC
Definition: _new.h:116

◆ address() [1/2]

template<class _Tp>
pointer allocator< _Tp >::address ( reference  __x) const
inline

Definition at line 298 of file _alloc.h.

298 {return &__x;}

◆ address() [2/2]

template<class _Tp>
const_pointer allocator< _Tp >::address ( const_reference  __x) const
inline

Definition at line 299 of file _alloc.h.

299 { return &__x; }

◆ allocate()

template<class _Tp>
_Tp* allocator< _Tp >::allocate ( size_type  __n,
const void = 0 
)
inline

Definition at line 301 of file _alloc.h.

301  {
302  if (__n > max_size()) {
304  }
305  if (__n != 0) {
306  size_type __buf_size = __n * sizeof(value_type);
307  _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
308 #if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
309  memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
310 #endif
311  return __ret;
312  }
313 
314  return 0;
315  }
return __n
Definition: _algo.h:75
size_t size_type
Definition: _alloc.h:282
static void *_STLP_CALL allocate(size_t &__n)
Definition: _alloc.h:157
#define _STLP_SHRED_BYTE
Definition: features.h:903
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
size_type max_size() const _STLP_NOTHROW
Definition: _alloc.h:330
_Tp value_type
Definition: _alloc.h:277
#define memset(x, y, z)
Definition: compat.h:39
#define _STLP_THROW_BAD_ALLOC
Definition: _new.h:116

Referenced by bad_alloc_test1(), and AllocatorTest::zero_allocation().

◆ construct()

template<class _Tp>
void allocator< _Tp >::construct ( pointer  __p,
const_reference  __val 
)
inline

Definition at line 331 of file _alloc.h.

void _Copy_Construct(_Tp *__p, const _Tp &__val)
Definition: _construct.h:130
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656

◆ deallocate() [1/2]

template<class _Tp>
void allocator< _Tp >::deallocate ( pointer  __p,
size_type  __n 
)
inline

Definition at line 317 of file _alloc.h.

317  {
318  _STLP_ASSERT( (__p == 0) == (__n == 0) )
319  if (__p != 0) {
320 #if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
321  memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
322 #endif
323  __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
324  }
325  }
return __n
Definition: _algo.h:75
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define _STLP_SHRED_BYTE
Definition: features.h:903
static void _STLP_CALL deallocate(void *__p, size_t __n)
Definition: _alloc.h:160
_Tp value_type
Definition: _alloc.h:277
#define _STLP_ASSERT(expr)
Definition: _debug.h:165
#define memset(x, y, z)
Definition: compat.h:39

◆ deallocate() [2/2]

template<class _Tp>
void allocator< _Tp >::deallocate ( pointer  __p) const
inline

Definition at line 328 of file _alloc.h.

328 { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
static void _STLP_CALL deallocate(void *__p, size_t __n)
Definition: _alloc.h:160
_Tp value_type
Definition: _alloc.h:277

◆ destroy()

template<class _Tp>
void allocator< _Tp >::destroy ( pointer  __p)
inline

Definition at line 332 of file _alloc.h.

332 { _STLP_STD::_Destroy(__p); }
void _Destroy(_Tp *__pointer)
Definition: _construct.h:63

◆ max_size()

template<class _Tp>
size_type allocator< _Tp >::max_size ( ) const
inline

Definition at line 330 of file _alloc.h.

330 { return size_t(-1) / sizeof(value_type); }
__kernel_size_t size_t
Definition: linux.h:237
_Tp value_type
Definition: _alloc.h:277

Referenced by allocator< _CharT >::_M_allocate(), and allocator< _CharT >::allocate().


The documentation for this class was generated from the following file: