30 #ifndef BIT_MEMORY_ALLOCATORS_NEW_ALLOCATOR_HPP 31 #define BIT_MEMORY_ALLOCATORS_NEW_ALLOCATOR_HPP 33 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 37 #include "detail/named_allocator.hpp" 39 #include "../utilities/allocator_info.hpp" 40 #include "../utilities/macros.hpp" 41 #include "../utilities/owner.hpp" 45 #include <type_traits> 66 using default_alignment = std::integral_constant<std::size_t,alignof(std::max_align_t)>;
114 owner<void*>
try_allocate( std::size_t size, std::size_t align ) noexcept;
120 void deallocate( owner<void*> p, std::size_t size );
140 using named_new_allocator = detail::named_allocator<new_allocator>;
145 #include "detail/new_allocator.inl" owner< void * > try_allocate(std::size_t size, std::size_t align) noexcept
Attempts to allocate memory of size size, returning nullptr on failure.
This stateless allocator performs all of its allocation calls using raw calls to 'new', and frees memory with 'delete'.
allocator_info info() const noexcept
Gets the info about this allocator.
void deallocate(owner< void *> p, std::size_t size)
Deallocates a pointer p with the allocation size of size.
new_allocator & operator=(new_allocator &&other) noexcept=default
Move-assigns a new_allocator from another allocator.
new_allocator()=default
Default-constructs a new_allocator.
This type is used to hold the generic information for a given allocator.