23#include <flow/util/util.hpp>
127template<
typename T,
typename Arena_t>
169 using size_type = std::make_unsigned_t<difference_type>;
234template<typename T, typename Arena_t>
237 static_assert(
alignof(
Value) <= flow::util::max_align_sz(),
238 "Arena::allocate() takes no alignment arg and guarantees only std::max_align_t alignment; "
239 "over-aligned value types are not supported.");
242 assert(arena &&
"Before working with SHM-stored STL-compliant objects: activate an Arena via Arena_activator "
243 "in the thread in question.");
255 return std::pointer_traits<Pointer>::pointer_to
256 (*(
static_cast<Value*
>
257 (arena->allocate(n *
sizeof(
Value)))));
260template<
typename T,
typename Arena_t>
264 assert(arena &&
"Before working with SHM-stored STL-compliant objects: activate an Arena via Arena_activator "
265 "in the thread in question.");
273 arena->deallocate(
static_cast<void*
>(p.operator->()));
276template<
typename T,
typename Arena_t>
279template<
typename T,
typename Arena_t>
286template<
typename T,
typename Arena_t>
293template<
typename Arena_t,
typename T1,
typename T2>
296 static_assert(std::is_empty_v<Stateless_allocator<T1, Arena_t>>,
297 "Stateless_allocator<> is currently designed around being empty (static-data-only) -- "
298 "did it gain state?");
302template<
typename Arena_t,
typename T1,
typename T2>
static Arena * this_thread_active_arena()
Returns the active arena, as understood by Stateless_allocator<T, Arena> (any T) at this point in the...
Stateless allocator usable with STL-compliant containers to store (or merely read) them directly in S...
Pointer pointer
Alias to Pointer for compatibility with STL-compliant machinery (traits, etc.).
Stateless_allocator()
Allocator concept requirement for default-ctor: no-op since it's a stateless allocator.
Pointer allocate(size_t n) const
Allocates an uninitialized buffer of given size, or throws exception if Arena::allocate() does; satis...
Arena_t Arena
Alias for the Arena_t type this uses for allocation/deallocation/pointer semantics.
Value value_type
Alias to Value for compatibility with STL-compliant machinery (traits, etc.).
bool operator==(const Stateless_allocator< T1, Arena_t > &val1, const Stateless_allocator< T2, Arena_t > &val2)
Returns true for any 2 Stateless_allocators managing the same Stateless_allocator::Arena.
void deallocate(Pointer p, size_t n_ignored=0) const noexcept
Deallocates buffer in SHM previously allocated via allocate() or equivalent in this or other (if Aren...
bool operator!=(const Stateless_allocator< T1, Arena_t > &val1, const Stateless_allocator< T2, Arena_t > &val2)
Returns false for any 2 Stateless_allocators managing the same Stateless_allocator::Arena.
std::make_unsigned_t< difference_type > size_type
Unsigned counterpart of difference_type, for compatibility with STL-compliant machinery; see differen...
typename Arena::template Pointer< Value > Pointer
The required pointer-like type. See also pointer.
typename std::pointer_traits< Pointer >::difference_type difference_type
Signed type for differences between Pointer values, for compatibility with STL-compliant machinery (t...
ipc::shm sub-module providing integration between STL-compliant components (including containers) and...