BDE 4.14.0 Production release
|
#include <bslma_stdtestallocator.h>
Classes | |
struct | rebind |
Public Types | |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef TYPE * | pointer |
typedef const TYPE * | const_pointer |
typedef bsl::conditional< bsl::is_void< TYPE >::value, void, TYPE & >::type | reference |
typedef bsl::conditional< bsl::is_void< TYPE >::value, void, constTYPE & >::type | const_reference |
typedef TYPE | value_type |
An STL-compatible test allocator that forwards allocation calls to an underlying mechanism object of a type derived from bslma::TestAllocator
. This class template adheres to the allocator requirements defined in section 20.1.5 [lib.allocator.requirements] of the C++ standard and may be used to instantiate any [container] class template that follows the STL allocator protocol. The allocation mechanism is chosen at run-time, giving the programmer run-time control over how a container allocates and frees memory.
typedef const TYPE* bslma::StdTestAllocator< TYPE >::const_pointer |
typedef bsl::conditional<bsl::is_void<TYPE>::value,void,constTYPE&>::type bslma::StdTestAllocator< TYPE >::const_reference |
typedef std::ptrdiff_t bslma::StdTestAllocator< TYPE >::difference_type |
typedef TYPE* bslma::StdTestAllocator< TYPE >::pointer |
typedef bsl::conditional<bsl::is_void<TYPE>::value,void,TYPE&>::type bslma::StdTestAllocator< TYPE >::reference |
typedef std::size_t bslma::StdTestAllocator< TYPE >::size_type |
typedef TYPE bslma::StdTestAllocator< TYPE >::value_type |
|
inline |
TBD: fix comment to mention that the default allocator has to be a test allocator. Create a proxy object which will forward allocation calls to the object pointed to by bslma::Default::defaultAllocator()
. Postcondition:
|
inline |
TBD: fix comment to mention that mechanism
has to be a test allocator. Convert a bslma::Allocator
pointer to an test allocator object which forwards allocation calls to the object pointed to by the specified mechanism
. If mechanism
is 0, then the currently installed default allocator is used instead. Postcondition: 0 == mechanism || this->mechanism() == mechanism
.
|
inline |
Create a proxy object using the same mechanism as the specified original
. Postcondition: this->mechanism() == rhs.mechanism()
.
|
inline |
Create a proxy object sharing the same mechanism object as the specified rhs
. The newly constructed test allocator will compare equal to rhs
, even though they are instantiated on different types. Postcondition: this->mechanism() == rhs.mechanism()
.
bslma::StdTestAllocator< TYPE >::~StdTestAllocator | ( | ) |
const_pointer bslma::StdTestAllocator< TYPE >::address | ( | const_reference | x | ) | const |
Return the address of the object referred to by the specified x
, even if the (template parameter) TYPE
overloads the unary operator&
.
|
inline |
Return the address of the object referred to by the specified x
, even if the (template parameter) TYPE
overloads the unary operator&
.
|
inline |
Allocate enough (properly aligned) space for the specified n
objects of (template parameter) TYPE
by calling allocate
on the mechanism object. The optionally specified hint
argument is ignored by this test allocator type. The behavior is undefined unless n <= max_size()
.
bslma::StdTestAllocator< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION | ( | StdTestAllocator< TYPE > | , |
bslma::IsStdAllocator | |||
) |
bslma::StdTestAllocator< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION | ( | StdTestAllocator< TYPE > | , |
bslmf::IsBitwiseCopyable | |||
) |
bslma::StdTestAllocator< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION | ( | StdTestAllocator< TYPE > | , |
bslmf::IsBitwiseEqualityComparable | |||
) |
bslma::StdTestAllocator< TYPE >::BSLMF_NESTED_TRAIT_DECLARATION | ( | StdTestAllocator< TYPE > | , |
bslmf::IsBitwiseMoveable | |||
) |
|
inline |
Copy-construct an object of (template parameter) TYPE
from the specified val
at the memory address specified by p
. Do not directly allocate memory. The behavior is undefined unless p
is not properly aligned for objects of the given TYPE
.
|
inline |
Return memory previously allocated with allocate
to the underlying mechanism object by calling deallocate
on the mechanism object with the specified p
. The optionally specified n
argument is ignored by this test allocator type.
|
inline |
Call the TYPE
destructor for the object pointed to by the specified p
. Do not directly deallocate any memory.
|
inline |
Return the maximum number of elements of (template parameter) TYPE
that can be allocated using this test allocator. Note that there is no guarantee that attempts at allocating fewer elements than the value returned by max_size will not throw.
|
inline |
Return a pointer to the mechanism object to which this proxy forwards allocation and deallocation calls.
StdTestAllocator & bslma::StdTestAllocator< TYPE >::operator= | ( | const StdTestAllocator< TYPE > & | rhs | ) |