Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
H-G-Hristov committed Jul 10, 2024
1 parent 90764f0 commit 67d45f0
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ struct BigType {
template <typename T>
constexpr void test_empty(T value) {
using SingleView = std::ranges::single_view<T>;
SingleView sv{value};

std::same_as<bool> decltype(auto) result = SingleView::empty();
assert(result == false);
static_assert(noexcept(SingleView::empty()));
static_assert(noexcept(std::ranges::empty(sv)));
static_assert(noexcept(std::ranges::empty(std::as_const(sv))));
{
std::same_as<bool> decltype(auto) result = SingleView::empty();
assert(result == false);
static_assert(noexcept(SingleView::empty()));
}

{
SingleView sv{value};

std::same_as<bool> decltype(auto) result = std::ranges::empty(sv);
assert(result == false);
static_assert(noexcept(std::ranges::empty(sv)));
}
{
const SingleView sv{value};

std::same_as<bool> decltype(auto) result = std::ranges::empty(sv);
assert(result == false);
static_assert(noexcept(std::ranges::empty(std::as_const(sv))));
}
}

constexpr bool test() {
Expand Down

0 comments on commit 67d45f0

Please sign in to comment.