Removed span from-nullptr_t ctor.

This commit is contained in:
Neil MacIntosh 2018-02-10 19:21:22 -08:00
parent 72688ff009
commit 2bdbba7418
4 changed files with 3 additions and 56 deletions

View File

@ -341,8 +341,6 @@ public:
{
}
constexpr span(std::nullptr_t) GSL_NOEXCEPT : span() {}
constexpr span(pointer ptr, index_type count) : storage_(ptr, count) {}
constexpr span(pointer firstElem, pointer lastElem)

View File

@ -203,9 +203,6 @@ public:
// move assign
constexpr basic_string_span& operator=(basic_string_span&& other) GSL_NOEXCEPT = default;
// from nullptr
constexpr basic_string_span(std::nullptr_t ptr) GSL_NOEXCEPT : span_(ptr) {}
constexpr basic_string_span(pointer ptr, index_type length) : span_(ptr, length) {}
constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) {}

View File

@ -94,48 +94,6 @@ TEST_CASE("size_optimization")
}
}
TEST_CASE("from_nullptr_constructor")
{
{
span<int> s = nullptr;
CHECK((s.size() == 0 && s.data() == nullptr));
span<const int> cs = nullptr;
CHECK((cs.size() == 0 && cs.data() == nullptr));
}
{
span<int, 0> s = nullptr;
CHECK((s.size() == 0 && s.data() == nullptr));
span<const int, 0> cs = nullptr;
CHECK((cs.size() == 0 && cs.data() == nullptr));
}
{
#ifdef CONFIRM_COMPILATION_ERRORS
span<int, 1> s = nullptr;
CHECK((s.size() == 1 && s.data() == nullptr)); // explains why it can't compile
#endif
}
{
span<int> s{nullptr};
CHECK((s.size() == 0 && s.data() == nullptr));
span<const int> cs{nullptr};
CHECK((cs.size() == 0 && cs.data() == nullptr));
}
{
span<int*> s{nullptr};
CHECK((s.size() == 0 && s.data() == nullptr));
span<const int*> cs{nullptr};
CHECK((cs.size() == 0 && cs.data() == nullptr));
}
}
TEST_CASE("from_nullptr_size_constructor")
{
{
@ -1192,8 +1150,8 @@ TEST_CASE("crbegin_crend")
TEST_CASE("comparison_operators")
{
{
span<int> s1 = nullptr;
span<int> s2 = nullptr;
span<int> s1;
span<int> s2;
CHECK(s1 == s2);
CHECK(!(s1 != s2));
CHECK(!(s1 < s2));
@ -1230,7 +1188,7 @@ TEST_CASE("comparison_operators")
{
int arr[] = {2, 1}; // bigger
span<int> s1 = nullptr;
span<int> s1;
span<int> s2 = arr;
CHECK(s1 != s2);

View File

@ -511,12 +511,6 @@ TEST_CASE("Constructors")
CHECK(span.length() == 0);
}
// from nullptr
{
cstring_span<> span(nullptr);
CHECK(span.length() == 0);
}
// from string literal
{
cstring_span<> span = "Hello";