|
BDE 4.14.0 Production release
|
Provide a class for testing that allocates with bsl::allocator.
This component provides a single, unconstrained (value-semantic) attribute class, AllocTestType, that uses a bsl::allocator<> to supply memory and defines the type trait bslma::UsesBslmaAllocator. Furthermore, this class is not bitwise-moveable, and will assert on destruction if it has been moved. This class is primarily provided to facilitate testing of templates by defining a simple type representative of user-defined types having an allocator.
data: representation of the object's valueallocator: allocator used by the objectThis section illustrates intended use of this component.
Suppose we wanted to print the supported traits of this test type.
First, we create a function template printTypeTraits with a parameterized TYPE:
Now, we invoke the printTypeTraits function template using AllocTestType as the parameterized TYPE:
Finally, we observe the console output: