From 1841f63a4057f238c758cab4a1580eb65a606ee4 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 19 Oct 2021 21:08:18 -0400 Subject: [PATCH] common/alignment: Fix VS2022 compilation VS2022 seems to introduce an optimization when moving vectors to check for equality of the element values. AlignmentAllocator needed to overload the equality operator to fix compilation of its usage in vector moving. --- src/common/alignment.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/alignment.h b/src/common/alignment.h index 1b56569d17..8570c7d3c4 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -64,7 +64,7 @@ public: 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; + using is_always_equal = std::false_type; constexpr AlignmentAllocator() noexcept = default; @@ -83,6 +83,11 @@ public: struct rebind { using other = AlignmentAllocator; }; + + template + constexpr bool operator==(const AlignmentAllocator&) const noexcept { + return std::is_same_v && Align == Align2; + } }; } // namespace Common