Allocates uninitialized storage whose memory-alignment is specified by alignment. More...
#include <seqan3/range/container/aligned_allocator.hpp>
Classes | |
| struct | rebind |
| The aligned_allocator member template class aligned_allocator::rebind provides a way to obtain an allocator for a different type. More... | |
Public Types | |
| using | difference_type = typename std::pointer_traits< pointer >::difference_type |
| The difference type of the allocation. | |
| using | is_always_equal = std::true_type |
| Are any two allocators of the same aligned_allocator type always compare equal? | |
| using | pointer = value_type * |
| The pointer type of the allocation. | |
| using | size_type = std::make_unsigned_t< difference_type > |
| The size type of the allocation. | |
| using | value_type = value_t |
| The value type of the allocation. | |
Public Member Functions | |
| pointer | allocate (size_type n) |
Allocates n * sizeof(T) bytes of uninitialized storage by calling std::aligned_alloc, but it is unspecified when and how this function is called. More... | |
| void | deallocate (pointer p, size_type) noexcept |
| Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate(). More... | |
Constructors, destructor and assignment | |
| aligned_allocator ()=default | |
| Defaulted. | |
| aligned_allocator (aligned_allocator const &)=default | |
| Defaulted. | |
| aligned_allocator (aligned_allocator &&)=default | |
| Defaulted. | |
| aligned_allocator & | operator= (aligned_allocator const &)=default |
| Defaulted. | |
| aligned_allocator & | operator= (aligned_allocator &&)=default |
| Defaulted. | |
| ~aligned_allocator ()=default | |
| Defaulted. | |
| template<class other_value_type > | |
| constexpr | aligned_allocator (aligned_allocator< other_value_type, alignment > const &) noexcept |
| Copy constructor with different value type. | |
Comparison operators | |
| template<class value_type2 , size_t alignment2> | |
| constexpr bool | operator== (aligned_allocator< value_type2, alignment2 > const &) noexcept |
| Returns true if the memory-alignment matches. | |
| template<class value_type2 , size_t alignment2> | |
| constexpr bool | operator!= (aligned_allocator< value_type2, alignment2 > const &) noexcept |
| Returns false if the memory-alignment mismatches. | |
Static Public Attributes | |
| static constexpr size_t | alignment = alignment_v |
| The memory-alignment of the allocation. | |
Allocates uninitialized storage whose memory-alignment is specified by alignment.
| value_t | The value type of the allocation. |
| alignment_v | The memory-alignment of the allocation. |
Will output something like:
As you can see, in the case of the aligned_allocator it is guaranteed that the first element in the vector starts at offset 0.
|
inline |
Allocates n * sizeof(T) bytes of uninitialized storage by calling std::aligned_alloc, but it is unspecified when and how this function is called.
| Throws | std::bad_alloc if allocation fails. |
|
inlinenoexcept |
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate().
The argument n must be equal to the first argument of the call to allocate() that originally produced p; otherwise, the behavior is undefined.
Calls std::free, but it is unspecified when and how it is called.