36 lines
2.4 KiB
Markdown
36 lines
2.4 KiB
Markdown
[char.traits.specializations.char]
|
||
|
||
# 27 Strings library [[strings]](./#strings)
|
||
|
||
## 27.2 Character traits [[char.traits]](char.traits#specializations.char)
|
||
|
||
### 27.2.4 char_traits specializations [[char.traits.specializations]](char.traits.specializations#char)
|
||
|
||
#### 27.2.4.2 struct char_traits<char> [char.traits.specializations.char]
|
||
|
||
[ð](#lib:char_traits)
|
||
|
||
namespace std {template<> struct char_traits<char> {using char_type = char; using int_type = int; using off_type = streamoff; using pos_type = streampos; using state_type = mbstate_t; using comparison_category = strong_ordering; static constexpr void assign(char_type& c1, const char_type& c2) noexcept; static constexpr bool eq(char_type c1, char_type c2) noexcept; static constexpr bool lt(char_type c1, char_type c2) noexcept; static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); static constexpr size_t length(const char_type* s); static constexpr const char_type* find(const char_type* s, size_t n, const char_type& a); static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n); static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n); static constexpr char_type* assign(char_type* s, size_t n, char_type a); static constexpr int_type not_eof(int_type c) noexcept; static constexpr char_type to_char_type(int_type c) noexcept; static constexpr int_type to_int_type(char_type c) noexcept; static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; static constexpr int_type eof() noexcept; };}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L308)
|
||
|
||
The type mbstate_t is defined in [<cwchar>](cwchar.syn#header:%3ccwchar%3e "28.7.3 Header <cwchar> synopsis [cwchar.syn]") and can represent any of the conversion states that can occur in animplementation-defined set of supported multibyte
|
||
character encoding rules[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L314)
|
||
|
||
The two-argument member assign is defined identically to the
|
||
built-in operator =[.](#2.sentence-1)
|
||
|
||
The two-argument members eq and lt are defined identically to the built-in operators== and < for type unsigned char[.](#2.sentence-2)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L320)
|
||
|
||
The membereof() returnsEOF[.](#3.sentence-1)
|