30 #ifndef BIT_MEMORY_ALLOCATORS_MALLOC_ALLOCATOR_HPP 31 #define BIT_MEMORY_ALLOCATORS_MALLOC_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/owner.hpp" 41 #include "../utilities/macros.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_malloc_allocator = detail::named_allocator<malloc_allocator>;
145 #include "detail/malloc_allocator.inl" malloc_allocator & operator=(malloc_allocator &&other) noexcept=default
Move-assigns a malloc_allocator from another allocator.
This stateless allocator performs all of its allocation calls using raw calls to 'malloc', and frees memory with 'free'.
allocator_info info() const noexcept
Gets the info about this allocator.
malloc_allocator()=default
Default-constructs a malloc_allocator.
void deallocate(owner< void *> p, std::size_t size)
Deallocates a pointer p with the allocation size of size.
This type is used to hold the generic information for a given allocator.
owner< void * > try_allocate(std::size_t size, std::size_t align) noexcept
Attempts to allocate memory of size size, returning nullptr on failure.