|
Orrery
A GPU-accelerated N-body gravitational simulator
|
A standard allocator that returns cache-line-aligned storage. More...
#include <orrery/core/aligned_allocator.hpp>
Static Public Member Functions | |
| static T * | allocate (std::size_t count) |
| Allocate storage for count objects. | |
| static void | deallocate (T *pointer, std::size_t) noexcept |
| static constexpr std::size_t | max_size () noexcept |
| The largest count that can be expressed in bytes without wrapping. | |
Static Public Attributes | |
| static constexpr std::size_t | kAlignment = kCacheLineBytes |
A standard allocator that returns cache-line-aligned storage.
The alignment is fixed rather than a template parameter. It is one decision about one machine, and it is reviewed here once instead of at every container that could otherwise ask for something different and be wrong without anyone noticing. A fixed alignment also keeps the allocator in the Alloc<T> shape that std::allocator_traits can rebind on its own, so this class needs no rebind member of its own.
|
inlinestaticnodiscard |
Allocate storage for count objects.
Static because the allocator carries no state that allocation could depend on. The standard's allocator requirements are written in terms of the expression a.allocate(n), which a static member satisfies, so containers are unaffected by the distinction.