![]() |
Home | Libraries | People | FAQ | More |
boost::alignment::aligned_allocator_adaptor
// In header: <boost/align/aligned_allocator_adaptor.hpp> template<typename Allocator, std::size_t Alignment> class aligned_allocator_adaptor : public Allocator { public: // types typedef Traits::value_type value_type; typedef Traits::size_type size_type; typedef value_type * pointer; typedef const value_type * const_pointer; typedef void * void_pointer; typedef const void * const_void_pointer; typedef std::ptrdiff_t difference_type; // member classes/structs/unions template<typename U> struct rebind { // types typedef aligned_allocator_adaptor< typename Traits::template rebind_alloc< U >, Alignment > other; }; // construct/copy/destruct aligned_allocator_adaptor() = default; template<typename A> explicit aligned_allocator_adaptor(A &&) noexcept; template<typename U> aligned_allocator_adaptor(const aligned_allocator_adaptor< U, Alignment > &) noexcept; // public member functions Allocator & base() noexcept; const Allocator & base() const noexcept; pointer allocate(size_type); pointer allocate(size_type, const_void_pointer); void deallocate(pointer, size_type); };
Class template aligned_allocator_adaptor.
![]() |
Note |
|---|---|
This adaptor can be used with a C++11 allocator whose pointer type is a smart pointer but the adaptor will expose only raw pointers. |
typename Allocatorstd::size_t Alignment
Is the minimum alignment to specify for allocations, if it is larger than the alignment of the value type. The value of Alignment shall be a fundamental alignment value or an extended alignment value, and shall be a power of two.
aligned_allocator_adaptor
public
construct/copy/destructaligned_allocator_adaptor() = default;
Value-initializes the Allocator base class.
template<typename A> explicit aligned_allocator_adaptor(A && alloc) noexcept;
Initializes the Allocator base class with std::forward<A>(alloc).
Require: Allocator shall be constructible from A.
template<typename U> aligned_allocator_adaptor(const aligned_allocator_adaptor< U, Alignment > & other) noexcept;
Initializes the Allocator base class with the base from other.
aligned_allocator_adaptor public member functionsAllocator & base() noexcept;
Returns: |
|
const Allocator & base() const noexcept;
Returns: |
|
pointer allocate(size_type size);
Throw: Throws an exception thrown from A2::allocate if the storage cannot be obtained.
Note: The storage is obtained by calling A2::allocate on an object a2, where a2 of type A2 is a rebound copy of base() where its value_type is unspecified.
Parameters: |
|
||
Returns: |
A pointer to the initial element of an array of storage of size |
pointer allocate(size_type size, const_void_pointer hint);
Throw: Throws an exception thrown from A2::allocate if the storage cannot be obtained.
Note: The storage is obtained by calling A2::allocate on an object a2, where a2 of type A2 is a rebound copy of base() where its value_type is unspecified.
Parameters: |
|
||||
Returns: |
A pointer to the initial element of an array of storage of size |
void deallocate(pointer ptr, size_type size);
Deallocates the storage referenced by ptr.
Note: Uses A2::deallocate on an object a2, where a2 of type A2 is a rebound copy of base() where its value_type is unspecified.
Parameters: |
|