WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
smart_ptr.hpp File Reference

std::make_unique() / std::make_shared() replacement allocating memory through a RawAllocator. More...

#include "config.hpp"
#include <memory>
#include <type_traits>
#include "detail/utility.hpp"
#include "deleter.hpp"
#include "std_allocator.hpp"

Go to the source code of this file.

Classes

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...
 

Namespaces

namespace  wpi
 Foonathan namespace.
 
namespace  wpi::memory
 Memory namespace.
 
namespace  wpi::memory::detail
 

Functions

template<typename T , class RawAllocator , typename... Args>
auto wpi::memory::detail::allocate_unique (allocator_reference< RawAllocator > alloc, Args &&... args) -> std::unique_ptr< T, allocator_deleter< T, RawAllocator > >
 
template<typename T , typename... Args>
void wpi::memory::detail::construct (std::true_type, T *cur, T *end, Args &&... args)
 
template<typename T , typename... Args>
void wpi::memory::detail::construct (std::false_type, T *begin, T *end, Args &&... args)
 
template<typename T , class RawAllocator >
auto wpi::memory::detail::allocate_array_unique (std::size_t size, allocator_reference< RawAllocator > alloc) -> std::unique_ptr< T[], allocator_deleter< T[], RawAllocator > >
 
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.
 

Detailed Description

std::make_unique() / std::make_shared() replacement allocating memory through a RawAllocator.

Note
Only available on a hosted implementation.