Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ struct has_allocate_at_least {
constexpr bool test() {
{ // check that std::allocate_at_least forwards to allocator::allocate if no allocate_at_least exists
no_allocate_at_least<int> alloc;
std::same_as<std::allocation_result<int*>> decltype(auto) ret =
std::allocator_traits<decltype(alloc)>::allocate_at_least(alloc, 1);
using AllocTraits = std::allocator_traits<decltype(alloc)>;
std::same_as<std::allocation_result<int*>, AllocTraits::size_type> decltype(auto) ret =
AllocTraits::allocate_at_least(alloc, 1);
assert(ret.count == 1);
assert(ret.ptr == &alloc.t);
}

{ // check that std::allocate_at_least forwards to allocator::allocate_at_least if allocate_at_least exists
has_allocate_at_least<int> alloc;
std::same_as<std::allocation_result<int*>> decltype(auto) ret =
std::allocator_traits<decltype(alloc)>::allocate_at_least(alloc, 1);
using AllocTraits = std::allocator_traits<decltype(alloc)>;
std::same_as<std::allocation_result<int*>, AllocTraits::size_type> decltype(auto) ret =
AllocTraits::allocate_at_least(alloc, 1);
assert(ret.count == 2);
assert(ret.ptr == &alloc.t2);
}
Expand Down
Loading