Skip to content

Commit

Permalink
removed clear function
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Feb 11, 2024
1 parent b8fe638 commit 728f713
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 43 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ EXPECT_EQ(view.size(), 2);
EXPECT_EQ(view[0][0], 5);
EXPECT_EQ(view[1][0], 6);
EXPECT_EQ(view[1][1], 7);

// 3. Clear the builder to reuse its memory for successive creation of objects
builder.clear();
```
Expand Down
1 change: 0 additions & 1 deletion benchmarks/bitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ namespace flatmemory::benchmarks
for (size_t i = 0; i < num_bitsets; ++i) {
builder.finish();
views.push_back(builder);
builder.clear();
}
return views;
}
Expand Down
3 changes: 0 additions & 3 deletions include/flatmemory/details/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ namespace flatmemory
/// @brief Write serialized data to the stream.
void finish() { self().finish_impl(); }

/// @brief Clear all builders for reuse.
void clear() { self().clear_impl(); }

/// @brief Access the serialized buffer
auto& buffer() { return self().get_buffer_impl(); }
const auto& buffer() const { return self().get_buffer_impl(); }
Expand Down
6 changes: 0 additions & 6 deletions include/flatmemory/details/types/bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,6 @@ namespace flatmemory
m_buffer.set_size(buffer_size);
}

void clear_impl()
{
// Clear all nested builders.
m_blocks.clear();
}

[[nodiscard]] auto& get_buffer_impl() { return m_buffer; }
[[nodiscard]] const auto& get_buffer_impl() const { return m_buffer; }

Expand Down
19 changes: 0 additions & 19 deletions include/flatmemory/details/types/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,25 +209,6 @@ namespace flatmemory
finish_iterative_impl(std::make_index_sequence<sizeof...(Ts)>{});
}


template<size_t... Is>
void clear_iterative_impl(std::index_sequence<Is...>) {
([&] {
constexpr bool is_trivial = IsTriviallyCopyable<std::tuple_element_t<Is, std::tuple<Ts...>>>;
if constexpr (!is_trivial) {
auto& builder = std::get<Is>(m_data);
builder.clear();
}
}(), ...);
}


void clear_impl() {
// Clear all nested builders.
clear_iterative_impl(std::make_index_sequence<sizeof...(Ts)>{});
}


auto& get_buffer_impl() { return m_buffer; }
const auto& get_buffer_impl() const { return m_buffer; }

Expand Down
11 changes: 0 additions & 11 deletions include/flatmemory/details/types/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,6 @@ namespace flatmemory
m_buffer.set_size(buffer_size);
}

/* clear stl */
void clear_impl() {
// Clear all nested builders.
constexpr bool is_trivial = IsTriviallyCopyable<T_>;
if constexpr (!is_trivial) {
for (auto& builder : m_data) {
builder.clear();
}
}
}

[[nodiscard]] auto& get_buffer_impl() { return m_buffer; }
[[nodiscard]] const auto& get_buffer_impl() const { return m_buffer; }

Expand Down

0 comments on commit 728f713

Please sign in to comment.