4#ifndef WPI_MEMORY_SMART_PTR_HPP_INCLUDED 
    5#define WPI_MEMORY_SMART_PTR_HPP_INCLUDED 
   12#if !WPI_HOSTED_IMPLEMENTATION 
   13#error "This header is only available for a hosted implementation." 
   29            template <
typename T, 
class RawAllocator, 
typename... Args>
 
   31                -> std::unique_ptr<T, allocator_deleter<T, RawAllocator>>
 
   33                using raw_ptr = std::unique_ptr<T, allocator_deallocator<T, RawAllocator>>;
 
   35                auto memory = alloc.allocate_node(
sizeof(T), 
alignof(T));
 
   37                raw_ptr result(
static_cast<T*
>(
memory), {alloc});
 
   41                return {result.release(), {alloc}};
 
 
   44            template <
typename T, 
typename... Args>
 
   45            void construct(std::true_type, T* cur, T* end, Args&&... args)
 
   47                for (; cur != end; ++cur)
 
 
   51            template <
typename T, 
typename... Args>
 
   52            void construct(std::false_type, T* begin, T* end, Args&&... args)
 
   54#if WPI_HAS_EXCEPTION_SUPPORT 
   58                    for (; cur != end; ++cur)
 
   63                    for (
auto el = begin; el != cur; ++el)
 
 
   72            template <
typename T, 
class RawAllocator>
 
   74                -> std::unique_ptr<T[], allocator_deleter<T[], RawAllocator>>
 
   76                using raw_ptr = std::unique_ptr<T[], allocator_deallocator<T[], RawAllocator>>;
 
   78                auto memory = alloc.allocate_array(size, 
sizeof(T), 
alignof(T));
 
   80                raw_ptr result(
static_cast<T*
>(
memory), {alloc, size});
 
   81                construct(std::integral_constant<
bool, 
noexcept(T())>{}, result.get(),
 
   84                return {result.release(), {alloc, size}};
 
 
   92        template <
typename T, 
class RawAllocator>
 
  103        template <
class BaseType, 
class RawAllocator>
 
  115        template <
typename T, 
class RawAllocator, 
typename... Args>
 
  117            !std::is_array<T>::value,
 
  118            std::unique_ptr<T, 
allocator_deleter<T, 
typename std::decay<RawAllocator>::type>>)
 
 
  133        template <
typename T, 
class RawAllocator, 
typename... Args>
 
  150        template <
typename T, 
class RawAllocator>
 
  152            std::is_array<T>::value,
 
  153            std::unique_ptr<T, 
allocator_deleter<T, 
typename std::decay<RawAllocator>::type>>)
 
  156                typename std::remove_extent<T>::type>(size,
 
 
  168        template <
typename T, 
class RawAllocator>
 
  173            return detail::allocate_array_unique<typename std::remove_extent<T>::type,
 
 
  187        template <
typename T, 
class RawAllocator, 
typename... Args>
 
Similar to allocator_deallocator but calls the destructors of the object.
Definition deleter.hpp:165
Similar to allocator_polymorphic_deallocator but calls the destructors of the object.
Definition deleter.hpp:266
An alias template for allocator_storage using the reference_storage policy.
Definition allocator_storage.hpp:900
auto make_allocator_reference(RawAllocator &&allocator) noexcept -> allocator_reference< typename std::decay< RawAllocator >::type >
Definition allocator_storage.hpp:905
auto make_std_allocator(RawAllocator &&allocator) noexcept -> std_allocator< T, typename std::decay< RawAllocator >::type >
Definition std_allocator.hpp:338
A std::unique_ptr that deletes using a RawAllocator and allows polymorphic types.
Definition smart_ptr.hpp:106
#define WPI_ALIAS_TEMPLATE(Name,...)
Definition config.hpp:73
Deleter classes using a RawAllocator.
std::shared_ptr< T > allocate_shared(RawAllocator &&alloc, Args &&... args)
Creates a std::shared_ptr using a RawAllocator for the allocation.
Definition smart_ptr.hpp:188
auto allocate_unique(RawAllocator &&alloc, Args &&... args) ->
Creates a std::unique_ptr using a RawAllocator for the allocation.
Definition smart_ptr.hpp:116
detail namespace with internal helper functions
Definition input_adapters.h:32
void construct(std::true_type, T *cur, T *end, Args &&... args)
Definition smart_ptr.hpp:45
auto allocate_array_unique(std::size_t size, allocator_reference< RawAllocator > alloc) -> std::unique_ptr< T[], allocator_deleter< T[], RawAllocator > >
Definition smart_ptr.hpp:73
auto allocate_unique(allocator_reference< RawAllocator > alloc, Args &&... args) -> std::unique_ptr< T, allocator_deleter< T, RawAllocator > >
Definition smart_ptr.hpp:30
T && forward(typename std::remove_reference< T >::type &t) noexcept
Definition utility.hpp:31
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26
Class wpi::memory::std_allocator and related classes and functions.
Tag type that enables type-erasure in reference_storage.
Definition allocator_storage.hpp:322
#define WPI_REQUIRES_RET(Expr,...)
Definition utility.hpp:75