34 template <
typename T >
40 template <
typename U >
42 : resource_( other.resource_ )
53 void*
const res = resource_.get().allocate( n *
sizeof( T ),
alignof( T ) );
56 return reinterpret_cast< T*
>(
res );
61 result const res = resource_.get().deallocate(
62 reinterpret_cast< void*
>( p ), n *
sizeof( T ),
alignof( T ) );
63 if (
res == result::ERROR )
69 return lh.resource_.get().is_equal( rh.resource_.get() );
77 template <
typename U >
81 std::reference_wrapper< pmr::memory_resource > resource_;
Definition: allocator.h:36
allocator(allocator< U > const &other)
Definition: allocator.h:41
constexpr friend bool operator==(allocator const &lh, allocator const &rh)
Definition: allocator.h:67
T * allocate(std::size_t const n)
Definition: allocator.h:51
allocator(pmr::memory_resource &src)
Definition: allocator.h:46
void deallocate(T *const p, std::size_t const n) const
Definition: allocator.h:59
pmr::memory_resource & get_resource()
Definition: allocator.h:72
T value_type
Definition: allocator.h:38
Definition: memory_resource.h:33
MIT License.
Definition: aliases.h:36
void throw_bad_alloc()
Definition: throw_bad_alloc.h:32
T res
Definition: algorithm.h:505
result represents an result of some operation, as an alternative to returning just bool with true/fal...
Definition: result.h:42