diff --git a/AK/StringView.h b/AK/StringView.h index fb68c0e101..5db9b5673f 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -388,7 +388,7 @@ struct CaseInsensitiveASCIIStringViewTraits : public Traits { # define AK_STRING_VIEW_LITERAL_CONSTEVAL consteval #endif -[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(char const* cstring, size_t length) +[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator""sv(char const* cstring, size_t length) { return AK::StringView(cstring, length); } diff --git a/Documentation/Patterns.md b/Documentation/Patterns.md index 2aafb4154f..75a48d9f41 100644 --- a/Documentation/Patterns.md +++ b/Documentation/Patterns.md @@ -242,11 +242,11 @@ static_assert(AssertSize()); ## String View Literals -`AK::StringView` support for `operator"" sv` which is a special string literal operator that was added as of +`AK::StringView` support for `operator""sv` which is a special string literal operator that was added as of [C++17 to enable `std::string_view` literals](https://en.cppreference.com/w/cpp/string/basic_string_view/operator%22%22sv). ```cpp -[[nodiscard]] ALWAYS_INLINE constexpr AK::StringView operator"" sv(const char* cstring, size_t length) +[[nodiscard]] ALWAYS_INLINE constexpr AK::StringView operator""sv(const char* cstring, size_t length) { return AK::StringView(cstring, length); } diff --git a/Meta/Lagom/ReadMe.md b/Meta/Lagom/ReadMe.md index 13296c0979..4189d21c10 100644 --- a/Meta/Lagom/ReadMe.md +++ b/Meta/Lagom/ReadMe.md @@ -33,7 +33,7 @@ To implement this yourself: ``` - In addition, you will need to also add some compile options that Serenity uses to ensure no warnings or errors: ```cmake - add_compile_options(-Wno-literal-suffix) # AK::StringView defines operator"" sv, which GCC complains does not have an underscore. + add_compile_options(-Wno-literal-suffix) # AK::StringView defines operator""sv, which GCC complains does not have an underscore. add_compile_options(-fno-gnu-keywords) # JS::Value has a method named typeof, which also happens to be a GNU keyword. ```