From fe0f9b14cb7a03926d7b007112f906a621c0b32f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 17 Jun 2024 22:44:24 -0700 Subject: [PATCH] WIP --- BUILD.bazel | 1 + include/fixed_containers/memory.hpp | 6 +++--- test/pair_test.cpp | 26 +++++--------------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 1307c626..6a83e24e 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1379,6 +1379,7 @@ cc_test( deps = [ ":concepts", ":pair", + ":fixed_vector", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], diff --git a/include/fixed_containers/memory.hpp b/include/fixed_containers/memory.hpp index b34a1d1f..ea9c7467 100644 --- a/include/fixed_containers/memory.hpp +++ b/include/fixed_containers/memory.hpp @@ -12,10 +12,10 @@ namespace fixed_containers::memory // There appears to be more, to be investigated. // Returning an explicit `T*` also fails in certain cases (msvc). // As a workaround, don't return anything, which is a minor divergence with `std::construct_at()`. -template -constexpr void construct_at_address_of(T& p, Args&&... args) +template +constexpr auto construct_at_address_of(T& p, Args&&... args) { - std::construct_at(std::addressof(p), std::forward(args)...); + return std::construct_at(std::addressof(p), std::forward(args)...); } // Similar to https://en.cppreference.com/w/cpp/memory/destroy_at diff --git a/test/pair_test.cpp b/test/pair_test.cpp index f540ff89..8f89563d 100644 --- a/test/pair_test.cpp +++ b/test/pair_test.cpp @@ -1,23 +1,7 @@ -#include "fixed_containers/pair.hpp" +#include "fixed_containers/fixed_vector.hpp" -#include "fixed_containers/concepts.hpp" - -#include - -namespace fixed_containers +int main() { -#if defined(__clang__) || defined(__GNUC__) -static_assert(NotTriviallyCopyable>); -#else -static_assert(TriviallyCopyable>); -#endif - -#if defined(_GLIBCXX_RELEASE) and _GLIBCXX_RELEASE < 12 -static_assert(IsNotStructuralType>); -#else -static_assert(IsStructuralType>); -#endif - -static_assert(TriviallyCopyable>); -static_assert(IsStructuralType>); -} // namespace fixed_containers + fixed_containers::FixedVector, 55> nested_vector; + nested_vector.emplace_back(1); +}