[libc++][ranges][NFC] Format a couple of tests as a prerequisite (#190514)
to https://llvm.org/PR190513 to avoid friction.
This commit is contained in:
parent
c5a904946a
commit
792fce7cc3
@ -19,7 +19,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct Range : std::ranges::view_base {
|
struct Range : std::ranges::view_base {
|
||||||
constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) { }
|
constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) {}
|
||||||
constexpr int* begin() const { return begin_; }
|
constexpr int* begin() const { return begin_; }
|
||||||
constexpr int* end() const { return end_; }
|
constexpr int* end() const { return end_; }
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ static_assert(!test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pr
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static_assert( test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
|
static_assert(test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
|
||||||
"This constructor must not be explicit");
|
"This constructor must not be explicit");
|
||||||
|
|
||||||
#endif // TEST_STD_VER >= 23
|
#endif // TEST_STD_VER >= 23
|
||||||
|
|||||||
@ -20,18 +20,15 @@
|
|||||||
|
|
||||||
struct ViewWithCounting : std::ranges::view_base {
|
struct ViewWithCounting : std::ranges::view_base {
|
||||||
int* times_copied = nullptr;
|
int* times_copied = nullptr;
|
||||||
int* times_moved = nullptr;
|
int* times_moved = nullptr;
|
||||||
|
|
||||||
constexpr ViewWithCounting(int& copies_ctr, int& moves_ctr) : times_copied(&copies_ctr), times_moved(&moves_ctr) {}
|
constexpr ViewWithCounting(int& copies_ctr, int& moves_ctr) : times_copied(&copies_ctr), times_moved(&moves_ctr) {}
|
||||||
|
|
||||||
constexpr ViewWithCounting(const ViewWithCounting& rhs)
|
constexpr ViewWithCounting(const ViewWithCounting& rhs)
|
||||||
: times_copied(rhs.times_copied)
|
: times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
|
||||||
, times_moved(rhs.times_moved) {
|
|
||||||
++(*times_copied);
|
++(*times_copied);
|
||||||
}
|
}
|
||||||
constexpr ViewWithCounting(ViewWithCounting&& rhs)
|
constexpr ViewWithCounting(ViewWithCounting&& rhs) : times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
|
||||||
: times_copied(rhs.times_copied)
|
|
||||||
, times_moved(rhs.times_moved) {
|
|
||||||
++(*times_moved);
|
++(*times_moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,14 +36,14 @@ struct ViewWithCounting : std::ranges::view_base {
|
|||||||
constexpr const char* end() const { return nullptr; }
|
constexpr const char* end() const { return nullptr; }
|
||||||
|
|
||||||
constexpr ViewWithCounting& operator=(const ViewWithCounting&) = default;
|
constexpr ViewWithCounting& operator=(const ViewWithCounting&) = default;
|
||||||
constexpr ViewWithCounting& operator=(ViewWithCounting&&) = default;
|
constexpr ViewWithCounting& operator=(ViewWithCounting&&) = default;
|
||||||
constexpr bool operator==(const ViewWithCounting&) const { return true; }
|
constexpr bool operator==(const ViewWithCounting&) const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(std::ranges::forward_range<ViewWithCounting>);
|
static_assert(std::ranges::forward_range<ViewWithCounting>);
|
||||||
static_assert(std::ranges::view<ViewWithCounting>);
|
static_assert(std::ranges::view<ViewWithCounting>);
|
||||||
|
|
||||||
using View = ViewWithCounting;
|
using View = ViewWithCounting;
|
||||||
using Pattern = ViewWithCounting;
|
using Pattern = ViewWithCounting;
|
||||||
|
|
||||||
// SFINAE tests.
|
// SFINAE tests.
|
||||||
@ -58,7 +55,7 @@ static_assert(!test_convertible<std::ranges::lazy_split_view<View, Pattern>, Vie
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static_assert( test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
|
static_assert(test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
|
||||||
"This constructor must not be explicit");
|
"This constructor must not be explicit");
|
||||||
|
|
||||||
#endif // TEST_STD_VER >= 23
|
#endif // TEST_STD_VER >= 23
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user