70 template <
typename value_t,
size_t alignment_v = __STDCPP_DEFAULT_NEW_ALIGNMENT__>
84 using size_type = std::make_unsigned_t<difference_type>;
100 template <
class other_value_type,
size_t other_alignment>
141 throw std::bad_alloc{};
143 size_t bytes_to_allocate = n *
sizeof(
value_type);
144 if constexpr (
alignment <= __STDCPP_DEFAULT_NEW_ALIGNMENT__)
145 return static_cast<pointer>(::operator
new(bytes_to_allocate));
147 return static_cast<pointer>(::operator
new(bytes_to_allocate,
static_cast<std::align_val_t
>(
alignment)));
178 size_t bytes_to_deallocate = n *
sizeof(
value_type);
179 if constexpr (
alignment <= __STDCPP_DEFAULT_NEW_ALIGNMENT__)
180 ::
operator delete(p, bytes_to_deallocate);
182 ::operator
delete(p, bytes_to_deallocate,
static_cast<std::align_val_t
>(
alignment));
195 template <
typename new_value_type>
208 template <
class value_type2,
size_t alignment2>
215 template <
class value_type2,
size_t alignment2>
Allocates uninitialized storage whose memory-alignment is specified by alignment.
Definition: aligned_allocator.hpp:72
value_type * pointer
The pointer type of the allocation.
Definition: aligned_allocator.hpp:80
value_t value_type
The value type of the allocation.
Definition: aligned_allocator.hpp:78
void deallocate(pointer const p, size_type const n) const noexcept
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier c...
Definition: aligned_allocator.hpp:176
constexpr bool operator==(aligned_allocator< value_type2, alignment2 > const &) noexcept
Returns true if the memory-alignment matches.
Definition: aligned_allocator.hpp:209
pointer allocate(size_type const n) const
Allocates sufficiently large memory to hold n many elements of value_type.
Definition: aligned_allocator.hpp:137
constexpr aligned_allocator(aligned_allocator< other_value_type, other_alignment > const &) noexcept
Copy constructor with different value type and alignment.
Definition: aligned_allocator.hpp:101
~aligned_allocator()=default
Defaulted.
std::true_type is_always_equal
Do any two allocators of the same aligned_allocator type always compare equal?
Definition: aligned_allocator.hpp:87
std::make_unsigned_t< difference_type > size_type
The size type of the allocation.
Definition: aligned_allocator.hpp:84
constexpr bool operator!=(aligned_allocator< value_type2, alignment2 > const &) noexcept
Returns false if the memory-alignment mismatches.
Definition: aligned_allocator.hpp:216
aligned_allocator & operator=(aligned_allocator &&)=default
Defaulted.
aligned_allocator & operator=(aligned_allocator const &)=default
Defaulted.
aligned_allocator(aligned_allocator const &)=default
Defaulted.
static constexpr size_t alignment
The memory-alignment of the allocation.
Definition: aligned_allocator.hpp:75
aligned_allocator(aligned_allocator &&)=default
Defaulted.
aligned_allocator()=default
Defaulted.
typename std::pointer_traits< pointer >::difference_type difference_type
The difference type of the allocation.
Definition: aligned_allocator.hpp:82
Provides C++20 additions to the <memory> header.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The aligned_allocator member template class aligned_allocator::rebind provides a way to obtain an all...
Definition: aligned_allocator.hpp:197
static constexpr size_t other_alignment
The alignment for the rebound allocator.
Definition: aligned_allocator.hpp:199
Provides C++20 additions to the type_traits header.