WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
Adapters and Wrappers

Classes

class  wpi::memory::memory_resource
 The memory_resource abstract base class used in the implementation. More...
 
class  wpi::memory::memory_resource_adapter< RawAllocator >
 Wraps a RawAllocator and makes it a memory_resource. More...
 
class  wpi::memory::memory_resource_allocator
 Wraps a memory_resource and makes it a RawAllocator. More...
 
struct  wpi::memory::is_shared_allocator< memory_resource_allocator >
 Specialization of is_shared_allocator to mark memory_resource_allocator as shared. More...
 
class  wpi::memory::vector< T, RawAllocator >
 Alias template for an STL container that uses a certain RawAllocator. More...
 
struct  wpi::memory::forward_list_node_size< T >
 Contains the node size of a node based STL container with a specific type. More...
 
struct  wpi::memory::propagation_traits< RawAllocator >
 Controls the propagation of a std_allocator for a certain RawAllocator. More...
 
class  wpi::memory::std_allocator< T, RawAllocator >
 Wraps a RawAllocator and makes it a "normal" Allocator. More...
 
class  wpi::memory::any_std_allocator< T >
 An alias template for std_allocator using a type-erased RawAllocator. More...
 
class  wpi::memory::tracked_block_allocator< Tracker, BlockOrRawAllocator >
 A BlockAllocator adapter that tracks another allocator using a tracker. More...
 
class  wpi::memory::tracked_allocator< Tracker, RawAllocator >
 A RawAllocator adapter that tracks another allocator using a tracker. More...
 
class  wpi::memory::deeply_tracked_allocator< Tracker, RawAllocator >
 A tracked_allocator that has rebound any BlockAllocator to the corresponding deeply_tracked_block_allocator. More...
 
class  wpi::memory::aligned_allocator< RawAllocator >
 A RawAllocator adapter that ensures a minimum alignment. More...
 
class  wpi::memory::unique_ptr< T, RawAllocator >
 A std::unique_ptr that deletes using a RawAllocator. More...
 
class  wpi::memory::unique_base_ptr< BaseType, RawAllocator >
 A std::unique_ptr that deletes using a RawAllocator and allows polymorphic types. More...
 
class  wpi::memory::fallback_allocator< Default, Fallback >
 A RawAllocator with a fallback. More...
 
class  wpi::memory::growing_block_allocator< RawAllocator, Num, Den >
 A BlockAllocator that uses a given RawAllocator for allocating the blocks. More...
 
class  wpi::memory::fixed_block_allocator< RawAllocator >
 A BlockAllocator that allows only one block allocation. More...
 
class  wpi::memory::threshold_segregatable< RawAllocator >
 A Segregatable that allocates until a maximum size. More...
 
class  wpi::memory::binary_segregator< Segregatable, RawAllocator >
 A RawAllocator that either uses the Segregatable or the other RawAllocator. More...
 
class  wpi::memory::segregator< Allocators >
 Creates multiple nested binary_segregator. More...
 
class  wpi::memory::allocator_deallocator< Type, RawAllocator >
 A deleter class that deallocates the memory through a specified RawAllocator. More...
 
class  wpi::memory::allocator_deallocator< Type[], RawAllocator >
 Specialization of allocator_deallocator for array types. More...
 
class  wpi::memory::allocator_polymorphic_deallocator< BaseType, RawAllocator >
 A deleter class that deallocates the memory of a derived type through a specified RawAllocator. More...
 
class  wpi::memory::allocator_deleter< Type, RawAllocator >
 Similar to allocator_deallocator but calls the destructors of the object. More...
 
class  wpi::memory::allocator_deleter< Type[], RawAllocator >
 Specialization of allocator_deleter for array types. More...
 
class  wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >
 Similar to allocator_polymorphic_deallocator but calls the destructors of the object. More...
 

Typedefs

template<class Tracker , class BlockOrRawAllocator >
using wpi::memory::deeply_tracked_block_allocator
 Similar to tracked_block_allocator, but shares the tracker with the higher level allocator.
 

Functions

template<typename T , class RawAllocator , typename... Args>
auto wpi::memory::allocate_unique (RawAllocator &&alloc, Args &&... args) ->
 Creates a std::unique_ptr using a RawAllocator for the allocation.
 
template<typename T , class RawAllocator , typename... Args>
auto wpi::memory::allocate_unique (any_allocator, RawAllocator &&alloc, Args &&... args) ->
 Creates a std::unique_ptr using a type-erased RawAllocator for the allocation.
 
template<typename T , class RawAllocator >
auto wpi::memory::allocate_unique (RawAllocator &&alloc, std::size_t size) ->
 Creates a std::unique_ptr owning an array using a RawAllocator for the allocation.
 
template<typename T , class RawAllocator >
auto wpi::memory::allocate_unique (any_allocator, RawAllocator &&alloc, std::size_t size) ->
 Creates a std::unique_ptr owning an array using a type-erased RawAllocator for the allocation.
 
template<typename T , class RawAllocator , typename... Args>
std::shared_ptr< T > wpi::memory::allocate_shared (RawAllocator &&alloc, Args &&... args)
 Creates a std::shared_ptr using a RawAllocator for the allocation.
 
template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>>
std::stack< T, Container > wpi::memory::make_stack (RawAllocator &allocator)
 
template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>>
std::queue< T, Container > wpi::memory::make_queue (RawAllocator &allocator)
 
template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>, class Compare = std::less<T>>
std::priority_queue< T, Container, Compare > wpi::memory::make_priority_queue (RawAllocator &allocator, Compare comp={})
 

Detailed Description

Typedef Documentation

◆ deeply_tracked_block_allocator

template<class Tracker , class BlockOrRawAllocator >
using wpi::memory::deeply_tracked_block_allocator
Initial value:
implementation_defined

Similar to tracked_block_allocator, but shares the tracker with the higher level allocator.

This allows tracking both (de-)allocations and growth with one tracker.

Note
Due to implementation reasons, it cannot track growth and shrinking in the constructor/destructor of the higher level allocator.

Function Documentation

◆ allocate_shared()

template<typename T , class RawAllocator , typename... Args>
std::shared_ptr< T > wpi::memory::allocate_shared ( RawAllocator && alloc,
Args &&... args )

Creates a std::shared_ptr using a RawAllocator for the allocation.

It is similar to std::allocate_shared but uses a RawAllocator (and thus also supports any Allocator).

Effects:
Calls std_allocator::make_std_allocator to wrap the allocator and forwards to std::allocate_shared.
Returns:
A std::shared_ptr created using std::allocate_shared.
Note
If the allocator is stateful a reference to the RawAllocator will be stored inside the shared pointer, the caller has to ensure that the object lives as long as the smart pointer.

◆ allocate_unique() [1/4]

template<typename T , class RawAllocator , typename... Args>
auto wpi::memory::allocate_unique ( any_allocator ,
RawAllocator && alloc,
Args &&... args ) ->

Creates a std::unique_ptr using a type-erased RawAllocator for the allocation.

It is the same as the other overload but stores the reference to the allocator type-erased inside the std::unique_ptr.

Effects:
Allocates memory for the given type using the allocator and creates a new object inside it passing the given arguments to its constructor.
Returns:
A std::unique_ptr with a type-erased allocator reference owning that memory.
Note
If the allocator is stateful a reference to the RawAllocator will be stored inside the deleter, the caller has to ensure that the object lives as long as the smart pointer.

◆ allocate_unique() [2/4]

template<typename T , class RawAllocator >
auto wpi::memory::allocate_unique ( any_allocator ,
RawAllocator && alloc,
std::size_t size ) ->

Creates a std::unique_ptr owning an array using a type-erased RawAllocator for the allocation.

It is the same as the other overload but stores the reference to the allocator type-erased inside the std::unique_ptr.

Effects:
Allocates memory for an array of given size and value initializes each element inside of it.
Returns:
A std::unique_ptr with a type-erased allocator reference owning that array.
Note
If the allocator is stateful a reference to the RawAllocator will be stored inside the deleter, the caller has to ensure that the object lives as long as the smart pointer.

◆ allocate_unique() [3/4]

template<typename T , class RawAllocator , typename... Args>
auto wpi::memory::allocate_unique ( RawAllocator && alloc,
Args &&... args ) ->

Creates a std::unique_ptr using a RawAllocator for the allocation.

Effects:
Allocates memory for the given type using the allocator and creates a new object inside it passing the given arguments to its constructor.
Returns:
A std::unique_ptr owning that memory.
Note
If the allocator is stateful a reference to the RawAllocator will be stored inside the deleter, the caller has to ensure that the object lives as long as the smart pointer.

◆ allocate_unique() [4/4]

template<typename T , class RawAllocator >
auto wpi::memory::allocate_unique ( RawAllocator && alloc,
std::size_t size ) ->

Creates a std::unique_ptr owning an array using a RawAllocator for the allocation.

Effects:
Allocates memory for an array of given size and value initializes each element inside of it.
Returns:
A std::unique_ptr owning that array.
Note
If the allocator is stateful a reference to the RawAllocator will be stored inside the deleter, the caller has to ensure that the object lives as long as the smart pointer.

◆ make_priority_queue()

template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>, class Compare = std::less<T>>
std::priority_queue< T, Container, Compare > wpi::memory::make_priority_queue ( RawAllocator & allocator,
Compare comp = {} )

Convenience function to create a container adapter using a certain RawAllocator.

Returns:
An empty adapter with an implementation container using a reference to a given allocator.

◆ make_queue()

template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>>
std::queue< T, Container > wpi::memory::make_queue ( RawAllocator & allocator)

Convenience function to create a container adapter using a certain RawAllocator.

Returns:
An empty adapter with an implementation container using a reference to a given allocator.

◆ make_stack()

template<typename T , class RawAllocator , class Container = deque<T, RawAllocator>>
std::stack< T, Container > wpi::memory::make_stack ( RawAllocator & allocator)

Convenience function to create a container adapter using a certain RawAllocator.

Returns:
An empty adapter with an implementation container using a reference to a given allocator.