Skip to content

Commit 69e7e0a

Browse files
derekmaurocopybara-github
authored andcommitted
Add the deleted string_view(std::nullptr_t) constructor from C++23
This will reject string_view(nullptr) at compile-time. PiperOrigin-RevId: 835352115 Change-Id: Ic68e55d3eba02e002ed5f1791c40efbb0f0daaf0
1 parent 8036cae commit 69e7e0a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

absl/strings/string_view.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ class ABSL_ATTRIBUTE_VIEW string_view {
246246
}
247247
#endif // ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
248248

249+
// Deleted constructor from std::nullptr_t from C++23.
250+
string_view(std::nullptr_t) = delete;
251+
249252
constexpr string_view(const string_view&) noexcept = default;
250253
string_view& operator=(const string_view&) noexcept = default;
251254

0 commit comments

Comments
 (0)