Skip to content

Commit

Permalink
fix: workaround MSVC C4702 unreachable code
Browse files Browse the repository at this point in the history
hur dur UnREcHabLE CoDE
  • Loading branch information
tearfur committed Feb 22, 2024
1 parent 2d3a1b4 commit 6f85bed
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions include/small/detail/container/associative_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,17 +912,15 @@ namespace small::detail {
count(const K &x) const {
if constexpr (!IsMulti) {
return contains(x) ? 1 : 0;
}

if constexpr (IsOrdered) {
} else if constexpr (IsOrdered) {
auto [first, last] = equal_range(x);
return std::distance(first, last);
} else {
return std::count_if(begin(), end(), [this, &x](auto const &v) {
(void) this; // clang warns -Wunused-lambda-capture otherwise
return keys_equivalent(maybe_first(v), x);
});
}

return std::count_if(begin(), end(), [this, &x](auto const &v) {
(void)this; // clang warns -Wunused-lambda-capture otherwise
return keys_equivalent(maybe_first(v), x);
});
}

/// \brief Count elements with a given key
Expand Down

0 comments on commit 6f85bed

Please sign in to comment.