diff options
Diffstat (limited to 'libcxx/test/std/containers/views/span.cons/container.pass.cpp')
| -rw-r--r-- | libcxx/test/std/containers/views/span.cons/container.pass.cpp | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/libcxx/test/std/containers/views/span.cons/container.pass.cpp b/libcxx/test/std/containers/views/span.cons/container.pass.cpp index 07aac9229f0..d42013bd268 100644 --- a/libcxx/test/std/containers/views/span.cons/container.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/container.pass.cpp @@ -16,6 +16,7 @@ // constexpr span(const Container& cont); // // Remarks: These constructors shall not participate in overload resolution unless: +// — extent == dynamic_extent, // — Container is not a specialization of span, // — Container is not a specialization of array, // — is_array_v<Container> is false, @@ -48,17 +49,12 @@ void checkCV() { std::vector<int> v = {1,2,3}; -// Types the same (dynamic sized) +// Types the same { std::span< int> s1{v}; // a span< int> pointing at int. } -// Types the same (static sized) - { - std::span< int,3> s1{v}; // a span< int> pointing at int. - } - -// types different (dynamic sized) +// types different { std::span<const int> s1{v}; // a span<const int> pointing at int. std::span< volatile int> s2{v}; // a span< volatile int> pointing at int. @@ -66,24 +62,12 @@ void checkCV() std::span<const volatile int> s4{v}; // a span<const volatile int> pointing at int. } -// types different (static sized) - { - std::span<const int,3> s1{v}; // a span<const int> pointing at int. - std::span< volatile int,3> s2{v}; // a span< volatile int> pointing at int. - std::span< volatile int,3> s3{v}; // a span< volatile int> pointing at const int. - std::span<const volatile int,3> s4{v}; // a span<const volatile int> pointing at int. - } - // Constructing a const view from a temporary { std::span<const int> s1{IsAContainer<int>()}; - std::span<const int, 0> s2{IsAContainer<int>()}; std::span<const int> s3{std::vector<int>()}; - std::span<const int, 0> s4{std::vector<int>()}; (void) s1; - (void) s2; (void) s3; - (void) s4; } } @@ -92,11 +76,8 @@ template <typename T> constexpr bool testConstexprSpan() { constexpr IsAContainer<const T> val{}; - std::span<const T> s1{val}; - std::span<const T, 1> s2{val}; - return - s1.data() == val.getV() && s1.size() == 1 - && s2.data() == val.getV() && s2.size() == 1; + std::span<const T> s1{val}; + return s1.data() == val.getV() && s1.size() == 1; } @@ -107,12 +88,8 @@ void testRuntimeSpan() const IsAContainer<T> cVal; std::span<T> s1{val}; std::span<const T> s2{cVal}; - std::span<T, 1> s3{val}; - std::span<const T, 1> s4{cVal}; assert(s1.data() == val.getV() && s1.size() == 1); assert(s2.data() == cVal.getV() && s2.size() == 1); - assert(s3.data() == val.getV() && s3.size() == 1); - assert(s4.data() == cVal.getV() && s4.size() == 1); } struct A{}; |

