@@ -68,51 +68,15 @@ class string_view {
6868
6969 constexpr const char *data () const noexcept { return str ? str : " " ; }
7070
71- constexpr explicit operator std::string_view () const noexcept {
71+ constexpr operator std::string_view () const noexcept {
72+ if (str == nullptr )
73+ return std::string_view{};
7274#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
7375 return std::string_view (str, len);
7476#else
7577 return std::string_view (str);
7678#endif
7779 }
78-
79- #ifdef __INTEL_PREVIEW_BREAKING_CHANGES
80- friend constexpr bool operator ==(string_view lhs,
81- std::string_view rhs) noexcept {
82- return rhs == std::string_view (lhs);
83- }
84- friend constexpr bool operator ==(std::string_view lhs,
85- string_view rhs) noexcept {
86- return lhs == std::string_view (rhs);
87- }
88-
89- friend constexpr bool operator !=(string_view lhs,
90- std::string_view rhs) noexcept {
91- return rhs != std::string_view (lhs);
92- }
93- friend constexpr bool operator !=(std::string_view lhs,
94- string_view rhs) noexcept {
95- return lhs != std::string_view (rhs);
96- }
97- #else
98- friend constexpr bool operator ==(string_view lhs,
99- std::string_view rhs) noexcept {
100- return rhs == lhs.data ();
101- }
102- friend constexpr bool operator ==(std::string_view lhs,
103- string_view rhs) noexcept {
104- return lhs == rhs.data ();
105- }
106-
107- friend constexpr bool operator !=(string_view lhs,
108- std::string_view rhs) noexcept {
109- return rhs != lhs.data ();
110- }
111- friend constexpr bool operator !=(std::string_view lhs,
112- string_view rhs) noexcept {
113- return lhs != rhs.data ();
114- }
115- #endif
11680};
11781
11882} // namespace detail
0 commit comments