From 9aafb2a277f2fcbfcc881cf4759b66db07ae2e9f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 6 Oct 2019 18:29:18 -0400 Subject: alignment: Specify trait definitions within the allocator Allows containers and other data structures to consider optimizations based off of them. We satisfy all of these requirements anyways. --- src/common/alignment.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/alignment.h b/src/common/alignment.h index 88d5d3a65..e24f8b0e6 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -51,6 +51,11 @@ public: using reference = T&; using const_reference = const T&; + using propagate_on_container_copy_assignment = std::true_type; + using propagate_on_container_move_assignment = std::true_type; + using propagate_on_container_swap = std::true_type; + using is_always_equal = std::true_type; + public: pointer address(reference r) noexcept { return std::addressof(r); -- cgit v1.2.3 From 57ffada746f8a3ba68895f5f14dea4b17fd9eaa8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 6 Oct 2019 18:43:08 -0400 Subject: alignment: Resolve allocator construction issues on debug This was related to the source allocator being passed into the constructor potentially having a different type than allocator being constructed. We simply need to provide a constructor to handle this case. This resolves issues related to the allocator causing debug builds on MSVC to fail. --- src/common/alignment.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/alignment.h b/src/common/alignment.h index e24f8b0e6..cdd4833f8 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -57,6 +57,11 @@ public: using is_always_equal = std::true_type; public: + constexpr AlignmentAllocator() noexcept = default; + + template + constexpr AlignmentAllocator(const AlignmentAllocator&) noexcept {} + pointer address(reference r) noexcept { return std::addressof(r); } -- cgit v1.2.3