aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-01-30 00:33:44 -0800
committerChris Robinson <[email protected]>2023-01-30 00:33:44 -0800
commita719f0f963f5b47b78b89d84fdf8fe4cfa523323 (patch)
tree4d714f40945fcc39919cd892ae59c792099b15d8
parentc79b633a1ca0ad754c6739ea14b6ef8bc5c66aad (diff)
Don't pass an unnecessarily large alignment to allocator::rebind
-rw-r--r--common/almalloc.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/almalloc.h b/common/almalloc.h
index 809f4f1f..b5821784 100644
--- a/common/almalloc.h
+++ b/common/almalloc.h
@@ -72,8 +72,10 @@ enum FamCount : size_t { };
namespace al {
-template<typename T, std::size_t alignment=alignof(T)>
+template<typename T, std::size_t Align=alignof(T)>
struct allocator {
+ static constexpr std::size_t alignment{std::max(Align, alignof(T))};
+
using value_type = T;
using reference = T&;
using const_reference = const T&;
@@ -85,7 +87,7 @@ struct allocator {
template<typename U>
struct rebind {
- using other = allocator<U, (alignment<alignof(U))?alignof(U):alignment>;
+ using other = allocator<U, Align>;
};
constexpr explicit allocator() noexcept = default;