Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkaratarakis committed Jun 18, 2024
1 parent bba857c commit fe0f9b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ cc_test(
deps = [
":concepts",
":pair",
":fixed_vector",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
Expand Down
6 changes: 3 additions & 3 deletions include/fixed_containers/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T, typename ... Args>
constexpr void construct_at_address_of(T& p, Args&&... args)
template <typename T, typename... Args>
constexpr auto construct_at_address_of(T& p, Args&&... args)
{
std::construct_at(std::addressof(p), std::forward<Args>(args)...);
return std::construct_at(std::addressof(p), std::forward<Args>(args)...);
}

// Similar to https://en.cppreference.com/w/cpp/memory/destroy_at
Expand Down
26 changes: 5 additions & 21 deletions test/pair_test.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
#include "fixed_containers/pair.hpp"
#include "fixed_containers/fixed_vector.hpp"

#include "fixed_containers/concepts.hpp"

#include <utility>

namespace fixed_containers
int main()
{
#if defined(__clang__) || defined(__GNUC__)
static_assert(NotTriviallyCopyable<std::pair<int, int>>);
#else
static_assert(TriviallyCopyable<std::pair<int, int>>);
#endif

#if defined(_GLIBCXX_RELEASE) and _GLIBCXX_RELEASE < 12
static_assert(IsNotStructuralType<std::pair<int, int>>);
#else
static_assert(IsStructuralType<std::pair<int, int>>);
#endif

static_assert(TriviallyCopyable<Pair<int, int>>);
static_assert(IsStructuralType<Pair<int, int>>);
} // namespace fixed_containers
fixed_containers::FixedVector<fixed_containers::FixedVector<int, 31>, 55> nested_vector;
nested_vector.emplace_back(1);
}

0 comments on commit fe0f9b1

Please sign in to comment.