1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 08:47:35 +00:00

AK: Add support for AK::StringView literals with operator""sv

A new operator, operator""sv was added as of C++17 to support
string_view literals. This allows string_views to be constructed
from string literals and with no runtime cost to find the string
length.

See: https://en.cppreference.com/w/cpp/string/basic_string_view/operator%22%22sv

This change implements that functionality in AK::StringView.
We do have to suppress some warnings about implementing reserved
operators as we are essentially implementing STL functions in AK
as we have no STL :).
This commit is contained in:
Brian Gianforcaro 2021-02-24 04:50:00 -08:00 committed by Andreas Kling
parent a48d54dfc5
commit 31e1b08e15
4 changed files with 17 additions and 3 deletions

View file

@ -80,9 +80,9 @@ else()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fconcepts)
add_compile_options(-fconcepts -Wno-literal-suffix)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-Wno-overloaded-virtual)
add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals)
endif()
if (ENABLE_ALL_THE_DEBUG_MACROS)