initial impl of P1976R2
This commit is contained in:
1 parent
1999b48a51
commit
2085c7acde
6 files changed
+1267
-1241
No files matched your search
@@ -846,8 +846,6 @@ static_assert(!std::is_constructible<gsl::span<int, 3>, std::array<int, 500>&>::
|
||||
"!std::is_constructible<gsl::span<int, 3>, std::array<int, 500>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<int, 3>, const std::array<int, 3>&>::value,
|
||||
"!std::is_constructible<gsl::span<int, 3>, const std::array<int, 3>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>::value,
|
||||
"!std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<int, 500>&>::value,
|
||||
"!std::is_constructible<gsl::span<int, 3>, const gsl::span<int, 500>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int>&>::value,
|
||||
@@ -866,12 +864,8 @@ static_assert(!std::is_constructible<gsl::span<const int>, std::array<double, 3>
|
||||
static_assert(!std::is_constructible<gsl::span<const int>, const gsl::span<double, 3>&>::value,
|
||||
"!std::is_constructible<gsl::span<const int>, const gsl::span<double, 3>&>");
|
||||
|
||||
static_assert(!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>::value,
|
||||
"!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int, 500>&>::value,
|
||||
"!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int, 500>&>");
|
||||
static_assert(!std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>::value,
|
||||
"!std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>");
|
||||
static_assert(
|
||||
!std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int, 500>&>::value,
|
||||
"!std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int, 500>&>");
|
||||
@@ -925,6 +919,14 @@ static_assert(!std::is_constructible<gsl::span<const Derived>, std::array<Base,
|
||||
static_assert(!std::is_constructible<gsl::span<const Derived>, const std::array<Base, 3>&>::value,
|
||||
"!std::is_constructible<gsl::span<const Derived>, const std::array<Base, 3>&>");
|
||||
|
||||
// Explicit construction enabled in P1976R2
|
||||
static_assert(std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>::value,
|
||||
"std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>");
|
||||
static_assert(std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>::value,
|
||||
"std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>");
|
||||
static_assert(std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>::value,
|
||||
"std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>");
|
||||
|
||||
// no throw copy constructor
|
||||
static_assert(std::is_nothrow_copy_constructible<gsl::span<int>>::value,
|
||||
"std::is_nothrow_copy_constructible<gsl::span<int>>");
|
||||
|
||||
@@ -320,7 +320,7 @@ TEST(span_ext_test, make_span_from_array_constructor)
|
||||
{
|
||||
int arr[] = {1, 2, 3};
|
||||
|
||||
span<int> s1 = {&arr[0], 2}; // shorter
|
||||
span<int> s1 = span<int>(&arr[0], 2); // shorter
|
||||
span<int> s2 = arr; // longer
|
||||
|
||||
EXPECT_TRUE(s1 != s2);
|
||||
|
||||
@@ -157,7 +157,7 @@ TEST(span_test, from_pointer_length_constructor)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
{
|
||||
span<int> s = {&arr[0], narrow_cast<std::size_t>(i)};
|
||||
span<int> s = span<int>(&arr[0], narrow_cast<std::size_t>(i));
|
||||
EXPECT_TRUE(s.size() == narrow_cast<std::size_t>(i));
|
||||
EXPECT_TRUE(s.data() == &arr[0]);
|
||||
EXPECT_TRUE(s.empty() == (i == 0));
|
||||
@@ -165,7 +165,7 @@ TEST(span_test, from_pointer_length_constructor)
|
||||
EXPECT_TRUE(arr[j] == s[narrow_cast<std::size_t>(j)]);
|
||||
}
|
||||
{
|
||||
span<int> s = {&arr[i], 4 - narrow_cast<std::size_t>(i)};
|
||||
span<int> s = span<int>(&arr[i], 4 - narrow_cast<std::size_t>(i));
|
||||
EXPECT_TRUE(s.size() == 4 - narrow_cast<std::size_t>(i));
|
||||
EXPECT_TRUE(s.data() == &arr[i]);
|
||||
EXPECT_TRUE(s.empty() == ((4 - i) == 0));
|
||||
@@ -678,7 +678,7 @@ TEST(span_test, from_array_constructor)
|
||||
s2 = s1;
|
||||
EXPECT_TRUE(s2.empty());
|
||||
|
||||
auto get_temp_span = [&]() -> span<int> { return {&arr[1], 2}; };
|
||||
auto get_temp_span = [&]() -> span<int> { return span<int>(&arr[1], 2); };
|
||||
auto use_span = [&](span<const int> s) {
|
||||
EXPECT_TRUE(s.size() == 2);
|
||||
EXPECT_TRUE(s.data() == &arr[1]);
|
||||
|
||||
+1218
-1217
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user