Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion include/foonathan/memory/segregator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ namespace foonathan
return fallback_traits::max_array_size(get_fallback_allocator());
}

std::size_t max_alignemnt() const
std::size_t max_alignment() const
{
return fallback_traits::max_alignment(get_fallback_allocator());
}
Expand Down
16 changes: 16 additions & 0 deletions test/segregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,19 @@ TEST_CASE("segregator")
REQUIRE(get_fallback_allocator(s).no_allocated() == 1u);
s.deallocate_node(ptr, 17, 1);
}

TEST_CASE("binary_segregator max_alignment")
{
struct allocator : test_allocator
{
std::size_t max_alignment() const noexcept
{
return std::size_t(4 * 1024);
}
};
using segregatable = threshold_segregatable<allocator>;
using segregator = binary_segregator<segregatable, allocator>;

segregator s(threshold(8u, allocator{}));
REQUIRE(allocator_traits<segregator>::max_alignment(s) == 4 * 1024u);
}