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 Apr 5, 2024
1 parent 49862b4 commit 9b6d7be
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 9b6d7be

Please sign in to comment.