piranha
0.10
|
Allocator that tries to align memory to the cache line size. More...
#include <piranha/cache_aligning_allocator.hpp>
Classes | |
struct | rebind |
Allocator rebind. More... | |
Public Types | |
using | pointer = T * |
Pointer type. | |
using | const_pointer = T const * |
Const pointer type. | |
using | reference = T & |
Reference type. | |
using | const_reference = T const & |
Const reference type. | |
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 | |
void | destroy (pointer p) |
Destructor method. More... | |
template<typename U , typename... Args> | |
void | construct (U *p, Args &&... args) |
Variadic construction method. More... | |
cache_aligning_allocator () | |
Default constructor. More... | |
cache_aligning_allocator (const cache_aligning_allocator &)=default | |
Defaulted copy constructor. | |
cache_aligning_allocator (cache_aligning_allocator &&)=default | |
Defaulted move constructor. | |
template<typename U > | |
cache_aligning_allocator (const cache_aligning_allocator< U > &other) | |
Copy-constructor from different instance. More... | |
template<typename U > | |
cache_aligning_allocator (cache_aligning_allocator< U > &&other) | |
Move-constructor from different instance. More... | |
~cache_aligning_allocator ()=default | |
Defaulted destructor. | |
cache_aligning_allocator & | operator= (const cache_aligning_allocator &other)=default |
Copy assignment operator. More... | |
cache_aligning_allocator & | operator= (cache_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... | |
Allocator that tries to align memory to the cache line size.
This allocator will try to allocate memory aligned to the cache line size (as reported by piranha::settings).
Exception safety and move semantics are equivalent to piranha::dynamic_aligning_allocator.
Definition at line 50 of file cache_aligning_allocator.hpp.
|
inherited |
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.
|
inherited |
Value type of the allocator.
Alias for T
.
Definition at line 57 of file dynamic_aligning_allocator.hpp.
|
inline |
Default constructor.
Will invoke the base constructor with an alignment value determined as follows:
T
, it will be used as construction value;Definition at line 116 of file cache_aligning_allocator.hpp.
|
inlineexplicit |
Copy-constructor from different instance.
Will forward the call to the corresponding constructor in piranha::dynamic_aligning_allocator.
other | construction argument. |
Definition at line 130 of file cache_aligning_allocator.hpp.
|
inlineexplicit |
Move-constructor from different instance.
Will forward the call to the corresponding constructor in piranha::dynamic_aligning_allocator.
other | construction argument. |
Definition at line 140 of file cache_aligning_allocator.hpp.
|
inlineinherited |
Alignment getter.
Definition at line 183 of file dynamic_aligning_allocator.hpp.
|
inlineinherited |
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 |
Variadic construction method.
p | address where the object will be constructed. |
args | arguments that will be forwarded for construction. |
Definition at line 104 of file cache_aligning_allocator.hpp.
|
inlineinherited |
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 |
Destructor method.
p | address of the object of type T to be destroyed. |
Definition at line 91 of file cache_aligning_allocator.hpp.
|
inlineinherited |
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.
|
inlineinherited |
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
.
|
inlineinherited |
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.