BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsltf::StdTestAllocator< TYPE > Class Template Reference

#include <bsltf_stdtestallocator.h>

Classes

struct  rebind
 

Public Types

typedef bsls::Types::UintPtr size_type
 
typedef bsls::Types::IntPtr difference_type
 
typedef TYPE * pointer
 
typedef const TYPE * const_pointer
 
typedef TYPE & reference
 
typedef const TYPE & const_reference
 
typedef TYPE value_type
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (StdTestAllocator, bslma::IsStdAllocator)
 
 StdTestAllocator ()
 Create a StdTestAllocator object.
 
template<class BDE_OTHER_TYPE >
 StdTestAllocator (const StdTestAllocator< BDE_OTHER_TYPE > &)
 
pointer allocate (size_type numElements)
 
void deallocate (pointer address, size_type numElements=1)
 
template<class ELEMENT_TYPE , class... Args>
void construct (ELEMENT_TYPE *address, Args &&... arguments)
 
template<class ELEMENT_TYPE >
void destroy (ELEMENT_TYPE *address)
 
pointer address (reference object) const
 Return the address providing modifiable access to object.
 
const_pointer address (const_reference object) const
 Return the address providing non-modifiable access to object.
 
size_type max_size () const
 

Detailed Description

template<class TYPE>
class bsltf::StdTestAllocator< TYPE >

This allocator implements the minimal interface to comply with section 20.1.5 ([lib.allocator.requirements]) of the C++03 standard. Instances of this allocator delegate their operations to a globally configured delegate allocator as C++03 compliant allocators cannot have individually identifiable state (see StdTestAllocatorConfiguration and 'StdTestAllocatorConfigurationGuard).

See bsltf_stdtestallocator

Member Typedef Documentation

◆ const_pointer

template<class TYPE >
typedef const TYPE* bsltf::StdTestAllocator< TYPE >::const_pointer

◆ const_reference

template<class TYPE >
typedef const TYPE& bsltf::StdTestAllocator< TYPE >::const_reference

◆ difference_type

template<class TYPE >
typedef bsls::Types::IntPtr bsltf::StdTestAllocator< TYPE >::difference_type

◆ pointer

template<class TYPE >
typedef TYPE* bsltf::StdTestAllocator< TYPE >::pointer

◆ reference

template<class TYPE >
typedef TYPE& bsltf::StdTestAllocator< TYPE >::reference

◆ size_type

template<class TYPE >
typedef bsls::Types::UintPtr bsltf::StdTestAllocator< TYPE >::size_type

◆ value_type

template<class TYPE >
typedef TYPE bsltf::StdTestAllocator< TYPE >::value_type

Constructor & Destructor Documentation

◆ StdTestAllocator() [1/2]

template<class TYPE >
bsltf::StdTestAllocator< TYPE >::StdTestAllocator ( )
inline

◆ StdTestAllocator() [2/2]

template<class TYPE >
template<class BDE_OTHER_TYPE >
bsltf::StdTestAllocator< TYPE >::StdTestAllocator ( const StdTestAllocator< BDE_OTHER_TYPE > &  )

Create a StdTestAllocator object. Note that this object will compare equal to the default constructed object, because this type has no state.

Member Function Documentation

◆ address() [1/2]

template<class TYPE >
StdTestAllocator< TYPE >::const_pointer bsltf::StdTestAllocator< TYPE >::address ( const_reference  object) const
inline

◆ address() [2/2]

template<class TYPE >
StdTestAllocator< TYPE >::pointer bsltf::StdTestAllocator< TYPE >::address ( reference  object) const
inline

◆ allocate()

template<class TYPE >
pointer bsltf::StdTestAllocator< TYPE >::allocate ( size_type  numElements)

Allocate enough (properly aligned) space for the specified numElements of type T. If the configured delegate allocator is unable to fulfill the allocation request, an exception (typically bsl::bad_alloc) will be thrown. The behavior is undefined unless numElements <= max_size().

◆ BSLMF_NESTED_TRAIT_DECLARATION()

template<class TYPE >
bsltf::StdTestAllocator< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION ( StdTestAllocator< TYPE >  ,
bslma::IsStdAllocator   
)

◆ construct()

template<class TYPE >
template<class ELEMENT_TYPE , class... Args>
void bsltf::StdTestAllocator< TYPE >::construct ( ELEMENT_TYPE *  address,
Args &&...  arguments 
)
inline

Create an object of (template parameter) ELEMENT_TYPE at the specified address, constructed by forwarding the specified argument1 and the (variable number of) additional specified arguments to the corresponding constructor of ELEMENT_TYPE. The behavior is undefined unless address refers to a block of memory having sufficient size and alignment for an object of ELEMENT_TYPE.

◆ deallocate()

template<class TYPE >
void bsltf::StdTestAllocator< TYPE >::deallocate ( pointer  address,
size_type  numElements = 1 
)
inline

Return memory previously at the specified address for numElements back to this allocator. The numElements argument is ignored by this allocator type. The behavior is undefined unless address was allocated using this allocator object and has not already been deallocated.

◆ destroy()

template<class TYPE >
template<class ELEMENT_TYPE >
void bsltf::StdTestAllocator< TYPE >::destroy ( ELEMENT_TYPE *  address)
inline

Call the ELEMENT_TYPE destructor for the object at the specified address but do not deallocate the memory at address.

◆ max_size()

template<class TYPE >
StdTestAllocator< TYPE >::size_type bsltf::StdTestAllocator< TYPE >::max_size ( ) const
inline

Return the maximum number of elements of type TYPE that can be allocated using this allocator in a single call to the allocate method. Note that there is no guarantee that attempts at allocating less elements than the value returned by max_size will not throw.


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