Files
2025-10-25 03:02:53 +03:00

73 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[basic.string.literals]
# 27 Strings library [[strings]](./#strings)
## 27.4 String classes [[string.classes]](string.classes#basic.string.literals)
### 27.4.7 Suffix for basic_string literals [basic.string.literals]
[🔗](#lib:operator%22%22s,string)
`constexpr string operator""s(const char* str, size_t len);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5407)
*Returns*: string{str, len}[.](#1.sentence-1)
[🔗](#lib:operator%22%22s,u8string)
`constexpr u8string operator""s(const char8_t* str, size_t len);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5417)
*Returns*: u8string{str, len}[.](#2.sentence-1)
[🔗](#lib:operator%22%22s,u16string)
`constexpr u16string operator""s(const char16_t* str, size_t len);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5427)
*Returns*: u16string{str, len}[.](#3.sentence-1)
[🔗](#lib:operator%22%22s,u32string)
`constexpr u32string operator""s(const char32_t* str, size_t len);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5437)
*Returns*: u32string{str, len}[.](#4.sentence-1)
[🔗](#lib:operator%22%22s,wstring)
`constexpr wstring operator""s(const wchar_t* str, size_t len);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5447)
*Returns*: wstring{str, len}[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L5452)
[*Note [1](#note-1)*:
The same suffix s is used for chrono::duration literals denoting seconds but there is no conflict, since duration suffixes apply to numbers and string literal suffixes apply to character array literals[.](#6.sentence-1)
— *end note*]