From 2bdbba7418e5b06d100e77831135f8f45970a6cd Mon Sep 17 00:00:00 2001 From: Neil MacIntosh Date: Sat, 10 Feb 2018 19:21:22 -0800 Subject: [PATCH] Removed span from-nullptr_t ctor. --- include/gsl/span | 2 -- include/gsl/string_span | 3 --- tests/span_tests.cpp | 48 +++---------------------------------- tests/string_span_tests.cpp | 6 ----- 4 files changed, 3 insertions(+), 56 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index 2f076e0..51b46f2 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -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) diff --git a/include/gsl/string_span b/include/gsl/string_span index c56d136..42f8975 100644 --- a/include/gsl/string_span +++ b/include/gsl/string_span @@ -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) {} diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index ebbf5ef..a71a228 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -94,48 +94,6 @@ TEST_CASE("size_optimization") } } -TEST_CASE("from_nullptr_constructor") -{ - { - span s = nullptr; - CHECK((s.size() == 0 && s.data() == nullptr)); - - span cs = nullptr; - CHECK((cs.size() == 0 && cs.data() == nullptr)); - } - - { - span s = nullptr; - CHECK((s.size() == 0 && s.data() == nullptr)); - - span cs = nullptr; - CHECK((cs.size() == 0 && cs.data() == nullptr)); - } - - { -#ifdef CONFIRM_COMPILATION_ERRORS - span s = nullptr; - CHECK((s.size() == 1 && s.data() == nullptr)); // explains why it can't compile -#endif - } - - { - span s{nullptr}; - CHECK((s.size() == 0 && s.data() == nullptr)); - - span cs{nullptr}; - CHECK((cs.size() == 0 && cs.data() == nullptr)); - } - - { - span s{nullptr}; - CHECK((s.size() == 0 && s.data() == nullptr)); - - span 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 s1 = nullptr; - span s2 = nullptr; + span s1; + span s2; CHECK(s1 == s2); CHECK(!(s1 != s2)); CHECK(!(s1 < s2)); @@ -1230,7 +1188,7 @@ TEST_CASE("comparison_operators") { int arr[] = {2, 1}; // bigger - span s1 = nullptr; + span s1; span s2 = arr; CHECK(s1 != s2); diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index 83171ac..0032b0f 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -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";