Skip to content

Commit

Permalink
added back builder non default constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Aug 28, 2024
1 parent 108f950 commit bdd2aa9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions include/flatmemory/details/types/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ class Builder<Tuple<Ts...>> : public IBuilder<Builder<Tuple<Ts...>>>
* Constructors
*/

// Builder(std::conditional_t<IsTriviallyCopyable<Ts>, Ts, Builder<Ts>>&&... args)
// requires(sizeof...(Ts) > 0)
// : m_data(std::forward<std::conditional_t<IsTriviallyCopyable<Ts>, Ts, Builder<Ts>>>(args)...), m_buffer()
//{
// }
Builder(std::conditional_t<IsTriviallyCopyable<Ts>, Ts, Builder<Ts>>&&... args)
requires(sizeof...(Ts) > 0)
: m_data(std::forward<std::conditional_t<IsTriviallyCopyable<Ts>, Ts, Builder<Ts>>>(args)...), m_buffer()
{
}

Builder() : m_data(), m_buffer() {}

Expand Down
34 changes: 17 additions & 17 deletions tests/unit/types/tuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,23 @@ TEST(FlatmemoryTests, TypesTupleEqualToAndHashTest)
EXPECT_EQ(const_view1, view3);
}

// TEST(FlatmemoryTests, TypesTupleSerializeViewsTest)
//{
// using BitsetVectorLayout = Vector<Bitset<uint64_t>>;
//
// auto builder1 = Builder<BitsetVectorLayout>();
// builder1.resize(2);
// builder1[0].set(4);
// builder1[1].set(64);
// builder1.finish();
//
// using BitsetTupleLayout = Tuple<View<BitsetVectorLayout>, ConstView<BitsetVectorLayout>>;
//
// auto builder2 = Builder<BitsetTupleLayout>(View<BitsetVectorLayout>(builder1.buffer().data()), ConstView<BitsetVectorLayout>(builder1.buffer().data()));
// builder2.finish();
//
// EXPECT_EQ(builder2.get<0>(), builder2.get<1>());
// }
TEST(FlatmemoryTests, TypesTupleSerializeViewsTest)
{
using BitsetVectorLayout = Vector<Bitset<uint64_t>>;

auto builder1 = Builder<BitsetVectorLayout>();
builder1.resize(2);
builder1[0].set(4);
builder1[1].set(64);
builder1.finish();

using BitsetTupleLayout = Tuple<View<BitsetVectorLayout>, ConstView<BitsetVectorLayout>>;

auto builder2 = Builder<BitsetTupleLayout>(View<BitsetVectorLayout>(builder1.buffer().data()), ConstView<BitsetVectorLayout>(builder1.buffer().data()));
builder2.finish();

EXPECT_EQ(builder2.get<0>(), builder2.get<1>());
}

TEST(FlatmemoryTests, TypesTupleViewMutateTest)
{
Expand Down

0 comments on commit bdd2aa9

Please sign in to comment.