WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::is_shared_allocator< RawAllocator > Struct Template Reference

Specifies whether or not a RawAllocator has shared semantics. More...

#include <wpi/memory/allocator_storage.hpp>

Inheritance diagram for wpi::memory::is_shared_allocator< RawAllocator >:

Detailed Description

template<class RawAllocator>
struct wpi::memory::is_shared_allocator< RawAllocator >

Specifies whether or not a RawAllocator has shared semantics.

It is shared, if - like allocator_reference - if multiple objects refer to the same internal allocator and if it can be copied. This sharing is stateful, however, stateless allocators are not considered shared in the meaning of this traits.
If a RawAllocator is shared, it will be directly embedded inside reference_storage since it already provides allocator_reference like semantics, so there is no need to add them manually,
Specialize it for your own types, if they provide sharing semantics and can be copied. They also must provide an operator== to check whether two allocators refer to the same shared one.

Note
This makes no guarantees about the lifetime of the shared object, the sharing allocators can either own or refer to a shared object.

The documentation for this struct was generated from the following file: