|
piranha
0.10
|
Memory allocator with runtime alignment support. More...
#include <piranha/dynamic_aligning_allocator.hpp>

Public Types | |
| using | value_type = T |
| Value type of the allocator. More... | |
| using | size_type = std::size_t |
| Size type. | |
| using | propagate_on_container_move_assignment = std::true_type |
| Move assignment propagation. More... | |
Public Member Functions | |
| dynamic_aligning_allocator () | |
| Default constructor. More... | |
| dynamic_aligning_allocator (const dynamic_aligning_allocator &)=default | |
| Defaulted copy constructor. | |
| dynamic_aligning_allocator (dynamic_aligning_allocator &&)=default | |
| Defaulted move constructor. | |
| dynamic_aligning_allocator (const std::size_t &alignment) | |
| Constructor from alignment value. More... | |
| template<typename U > | |
| dynamic_aligning_allocator (const dynamic_aligning_allocator< U > &other) | |
| Converting copy constructor. More... | |
| template<typename U > | |
| dynamic_aligning_allocator (dynamic_aligning_allocator< U > &&other) | |
| Converting move constructor. More... | |
| ~dynamic_aligning_allocator ()=default | |
| Defaulted destructor. | |
| dynamic_aligning_allocator & | operator= (const dynamic_aligning_allocator &other)=default |
| Copy assignment operator. More... | |
| dynamic_aligning_allocator & | operator= (dynamic_aligning_allocator &&other)=default |
| Move assignment operator. More... | |
| constexpr size_type | max_size () const |
| Maximum allocatable size. More... | |
| value_type * | allocate (const size_type &size) const |
| Allocation function. More... | |
| void | deallocate (value_type *ptr, const size_type &) const |
| Deallocation function. More... | |
| bool | operator== (const dynamic_aligning_allocator &other) const |
| Equality operator. More... | |
| bool | operator!= (const dynamic_aligning_allocator &other) const |
| Inequality operator. More... | |
| std::size_t | alignment () const |
| Alignment getter. More... | |
Memory allocator with runtime alignment support.
This allocator can be used to allocate memory aligned to a specific boundary, specified at runtime. The alignment value is provided upon construction and it is stored as a member of the allocator object. The allocator is standard-compliant and can hence be used in standard containers.
Definition at line 50 of file dynamic_aligning_allocator.hpp.
| using piranha::dynamic_aligning_allocator< T >::propagate_on_container_move_assignment = std::true_type |
Move assignment propagation.
This allocator has to be move assigned when the container using it is move assigned.
Definition at line 64 of file dynamic_aligning_allocator.hpp.
| using piranha::dynamic_aligning_allocator< T >::value_type = T |
Value type of the allocator.
Alias for T.
Definition at line 57 of file dynamic_aligning_allocator.hpp.
|
inline |
Default constructor.
Will set the internal alignment value to zero.
Definition at line 69 of file dynamic_aligning_allocator.hpp.
|
inlineexplicit |
Constructor from alignment value.
| alignment | alignment value that will be used for allocation. |
Definition at line 80 of file dynamic_aligning_allocator.hpp.
|
inlineexplicit |
Converting copy constructor.
After construction, the alignment will be the same as other.
| other | construction argument. |
Definition at line 90 of file dynamic_aligning_allocator.hpp.
|
inlineexplicit |
Converting move constructor.
After construction, the alignment will be the same as other.
| other | construction argument. |
Definition at line 100 of file dynamic_aligning_allocator.hpp.
|
inline |
Alignment getter.
Definition at line 183 of file dynamic_aligning_allocator.hpp.
|
inline |
Allocation function.
The allocation function is a thin wrapper around piranha::aligned_palloc().
| size | number of instances of type value_type for which the space will be allocated. |
| std::bad_alloc | if size is larger than max_size(). |
| unspecified | any exception thrown by piranha::aligned_palloc(). |
Definition at line 139 of file dynamic_aligning_allocator.hpp.
|
inline |
Deallocation function.
The allocation function is a thin wrapper around piranha::aligned_pfree().
| ptr | a pointer to a memory block allocated via allocate(). |
| unspecified | any exception thrown by piranha::aligned_pfree(). |
Definition at line 155 of file dynamic_aligning_allocator.hpp.
|
inline |
Maximum allocatable size.
value_type that can be allocated by a single call to allocate(). Definition at line 124 of file dynamic_aligning_allocator.hpp.
|
inline |
Inequality operator.
| other | comparison argument. |
Definition at line 175 of file dynamic_aligning_allocator.hpp.
|
default |
Copy assignment operator.
| other | the assignment argument. |
this.
|
default |
Move assignment operator.
| other | the assignment argument. |
this.
|
inline |
Equality operator.
| other | comparison argument. |
true if the alignments of this and other coincide, false otherwise. Definition at line 165 of file dynamic_aligning_allocator.hpp.
1.8.14