Skip to content

Commit

Permalink
Enabled disabled members due to dependent name
Browse files Browse the repository at this point in the history
  • Loading branch information
Flast committed Jun 11, 2024
1 parent 74c4968 commit 1d589af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
10 changes: 7 additions & 3 deletions docs/tied_sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,25 +303,29 @@ constexpr size_t size() const noexcept;
constexpr size_t max_size() const noexcept;
```

<!--
### reserve

```cpp
constexpr void reserve(size_type new_cap);
```
Available only if every sequences provide `reserve()`.
### capacity
```cpp
constexpr size_type capacity() const noexcept;
```

Available only if every sequences provide `capacity()`.

### shrink_to_fit

```cpp
constexpr void shrink_to_fit() noexcept;
constexpr void shrink_to_fit();
```
-->

Available only if every sequences provide `shrink_to_fit()`.

## Modifiers

Expand Down
9 changes: 2 additions & 7 deletions flat_map/tied_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,7 @@ class tied_sequence
constexpr reference back() { return *std::prev(end()); }
constexpr const_reference back() const { return *std::prev(end()); }

constexpr pointer data() noexcept((static_cast<void>(sizeof(std::declval<Sequences>().data())), ..., true))
{
return detail::tuple_transform([](auto& c) { return c.data(); }, _seq);
}
constexpr pointer data() noexcept { return detail::tuple_transform([](auto& c) { return c.data(); }, _seq); }

constexpr const_pointer data() const noexcept(noexcept(std::declval<tied_sequence*>()->data())) { return const_cast<tied_sequence*>(this)->data(); }

Expand All @@ -497,13 +494,11 @@ class tied_sequence
public:
constexpr size_t max_size() const noexcept { return detail::tuple_reduction([](auto&&... c) { return std::min({c.max_size()...}); }, _seq); }

#if 0 // TODO
constexpr void reserve(size_type new_cap) { detail::tuple_reduction([new_cap](auto&... c) { (c.reserve(new_cap), ...); }, _seq); }

constexpr size_type capacity() const noexcept { return detail::tuple_reduction([](auto&... c) { return std::min({c.capacity()...}); }, _seq); }

constexpr void shrink_to_fit() noexcept { detail::tuple_reduction([](auto&... c) { (c.shrink_to_fit(), ...); }, _seq); }
#endif
constexpr void shrink_to_fit() { detail::tuple_reduction([](auto&... c) { (c.shrink_to_fit(), ...); }, _seq); }

constexpr void clear() noexcept { detail::tuple_reduction([](auto&... c) { (c.clear(), ...); }, _seq); }

Expand Down
6 changes: 2 additions & 4 deletions test/tied_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,13 @@ TEST_CASE("capacity", "[capacity]")
REQUIRE(ts.max_size() > 0);
}

#if 0 // TODO
SECTION("reserve/capacity")
{
flat_map::tied_sequence<std::vector<int>, std::vector<int>> ts;
REQUIRE(ts.capacity() == 0);
REQUIRE(ts.size() == 0);
ts.reserve(10);
REQUIRE(ts.capacity() == 10);
REQUIRE(ts.capacity() >= 10);
REQUIRE(ts.size() == 0);
}

Expand All @@ -667,14 +666,13 @@ TEST_CASE("capacity", "[capacity]")

ts.reserve(10);
ts.push_back({0, 1});
REQUIRE(ts.capacity() == 10);
REQUIRE(ts.capacity() >= 10);
REQUIRE(ts.size() == 1);

ts.shrink_to_fit();
REQUIRE(ts.capacity() == 1);
REQUIRE(ts.size() == 1);
}
#endif

SECTION("clear")
{
Expand Down

0 comments on commit 1d589af

Please sign in to comment.