diff options
author | Linus Groh <mail@linusgroh.de> | 2023-02-25 16:14:37 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-25 20:51:49 +0100 |
commit | 85414d9338f5b4a25f46f519c07af161c48af45d (patch) | |
tree | b0b53ac6fbfd2c8176344b76714e8f3ed6d4eb31 /Userland/Libraries/LibKeyboard | |
parent | 956450df000c4b47f22f8a6c64607b9acc5e2cf1 (diff) | |
download | serenity-85414d9338f5b4a25f46f519c07af161c48af45d.zip |
AK: Add operator""_{short_,}string to create a String from a literal
We briefly discussed this when adding the new String type but couldn't
settle on a name. However, having to use String::from_utf8() on every
literal string is a bit unwieldy, so let's have these options available!
Naming-wise '_string' is not as short as 'sv' but should be relatively
clear; it also matches '_bigint' and '_ubigint' in length.
'_short_string' may be longer than the actual string itself, but it's
still an improvement over the static function :^)
Since our C++ source files are UTF-8 encoded anyway, it should be
impossible to create a string literal with invalid UTF-8, so including
that in the name is not as important as in the function that can receive
arbitrary data.
Diffstat (limited to 'Userland/Libraries/LibKeyboard')
0 files changed, 0 insertions, 0 deletions