ReactOS 0.4.15-dev-8061-g57b775e
pthread_allocator< _Tp > Class Template Reference

#include <_pthread_alloc.h>

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

Public Types

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

Public Member Functions

 pthread_allocator () _STLP_NOTHROW
 
 pthread_allocator (const pthread_allocator< _Tp > &a) _STLP_NOTHROW
 
 ~pthread_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)
 
size_type max_size () const _STLP_NOTHROW
 
void construct (pointer __p, const _Tp &__val)
 
void destroy (pointer _p)
 
_Tp * allocate (size_type __n, size_type &__allocated_n)
 

Private Types

typedef pthread_alloc _S_Alloc
 

Detailed Description

template<class _Tp>
class pthread_allocator< _Tp >

Definition at line 97 of file _pthread_alloc.h.

Member Typedef Documentation

◆ _S_Alloc

template<class _Tp >
typedef pthread_alloc pthread_allocator< _Tp >::_S_Alloc
private

Definition at line 98 of file _pthread_alloc.h.

◆ const_pointer

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

Definition at line 103 of file _pthread_alloc.h.

◆ const_reference

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

Definition at line 105 of file _pthread_alloc.h.

◆ difference_type

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

Definition at line 101 of file _pthread_alloc.h.

◆ pointer

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

Definition at line 102 of file _pthread_alloc.h.

◆ reference

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

Definition at line 104 of file _pthread_alloc.h.

◆ size_type

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

Definition at line 100 of file _pthread_alloc.h.

◆ value_type

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

Definition at line 106 of file _pthread_alloc.h.

Constructor & Destructor Documentation

◆ pthread_allocator() [1/2]

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

Definition at line 114 of file _pthread_alloc.h.

114{}

◆ pthread_allocator() [2/2]

template<class _Tp >
pthread_allocator< _Tp >::pthread_allocator ( const pthread_allocator< _Tp > &  a)
inline

Definition at line 115 of file _pthread_alloc.h.

115{}

◆ ~pthread_allocator()

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

Definition at line 122 of file _pthread_alloc.h.

122{}

Member Function Documentation

◆ address() [1/2]

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

Definition at line 125 of file _pthread_alloc.h.

125{ return &__x; }

◆ address() [2/2]

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

Definition at line 124 of file _pthread_alloc.h.

124{ return &__x; }

◆ allocate() [1/2]

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

Definition at line 129 of file _pthread_alloc.h.

129 {
130 if (__n > max_size()) {
132 }
133 if (__n != 0) {
134 size_type __buf_size = __n * sizeof(value_type);
135 _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
136#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
137 memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
138#endif
139 return __ret;
140 }
141 else
142 return 0;
143 }
return __n
Definition: _algo.h:75
#define _STLP_THROW_BAD_ALLOC
Definition: _new.h:116
size_type max_size() const _STLP_NOTHROW
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
#define _STLP_SHRED_BYTE
Definition: features.h:903
#define memset(x, y, z)
Definition: compat.h:39

◆ allocate() [2/2]

template<class _Tp >
_Tp * pthread_allocator< _Tp >::allocate ( size_type  __n,
size_type __allocated_n 
)
inline

Definition at line 168 of file _pthread_alloc.h.

168 {
169 if (__n > max_size()) {
171 }
172 if (__n != 0) {
173 size_type __buf_size = __n * sizeof(value_type);
174 _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
175#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
176 memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
177#endif
178 __allocated_n = __buf_size / sizeof(value_type);
179 return __ret;
180 }
181 else
182 return 0;
183 }

◆ construct()

template<class _Tp >
void pthread_allocator< _Tp >::construct ( pointer  __p,
const _Tp &  __val 
)
inline

Definition at line 158 of file _pthread_alloc.h.

158{ new(__p) _Tp(__val); }
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656

◆ deallocate()

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

Definition at line 145 of file _pthread_alloc.h.

145 {
146 _STLP_ASSERT( (__p == 0) == (__n == 0) )
147 if (__p != 0) {
148#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
149 memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
150#endif
151 _S_Alloc::deallocate(__p, __n * sizeof(value_type));
152 }
153 }
#define _STLP_ASSERT(expr)
Definition: _debug.h:165
if(dx< 0)
Definition: linetemp.h:194

◆ destroy()

template<class _Tp >
void pthread_allocator< _Tp >::destroy ( pointer  _p)
inline

Definition at line 159 of file _pthread_alloc.h.

159{ _p->~_Tp(); }

◆ max_size()

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

Definition at line 155 of file _pthread_alloc.h.

156 { return size_t(-1) / sizeof(_Tp); }
__kernel_size_t size_t
Definition: linux.h:237

Referenced by pthread_allocator< _Tp >::allocate().


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