A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../named_req/CharTraits.html below:

C++ named requirements: CharTraits - cppreference.com

CharTraits is a traits class that abstracts basic character and string operations for a given character type. Most standard library string and input/output classes require a CharTraits template type parameter alongside a corresponding character template type parameter.

[edit] Requirements

No operation listed below on CharTraits may throw an exception.

Given

[edit] Types Type Semantics X::char_type CharT X::int_type A type that can hold all valid values of X::char_type plus X::eof() X::off_type Invokes implementation-defined behavior if not std::streamoff when X is used as the traits template parameter in input/output classes. X::pos_type X::state_type  Destructible, CopyAssignable, CopyConstructible, DefaultConstructible [edit] Expressions Expression Return type Semantics  Complexity  X::eq(c, d) bool Returns: whether c is to be treated as equal to d Constant X::lt(c, d) bool Returns: whether c is to be treated as less than d Constant X::compare(p, q, n) int Returns: Linear X::length(p) std::size_t Returns: the smallest i such that X::eq(p[i], CharT()) is true Linear X::find(p, n, c) const X::char_type* Returns: Linear X::move(s, p, n) X::char_type* Linear X::copy(s, p, n) X::char_type* Linear X::assign(r, d) (Not used) Assigns r = d Constant X::assign(s, n, c) X::char_type* Linear X::not_eof(e) X::int_type Returns: Constant X::to_char_type(e) X::char_type Returns: Constant X::to_int_type(c) X::int_type Returns: some value e, constrained by the definitions of X::to_char_type and X::eq_int_type Constant X::eq_int_type(e, f) bool Constant X::eof() X::int_type Returns: a value e such that X::eq_int_type(e, X::to_int_type(c)) is false for all values c Constant [edit] Standard library

CharTraits is required by the following standard library class templates as a template type parameter:


CharTraits is satisfied by the following standard library explicit specializations of std::char_traits:

template<> class char_traits<char>;

template<> class char_traits<wchar_t>;
template<> class char_traits<char8_t>;
template<> class char_traits<char16_t>;

template<> class char_traits<char32_t>;

(since C++20)


(since C++11)
(since C++11) [edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 335 C++98 the requirements on the binary overload of
assign did not prevent assignments to rvalues its first argument
can only be an lvalue LWG 352 C++98 X::state_type was only
required to be CopyConstructible it is also required to be
CopyAssignable and DefaultConstructible LWG 3085 C++98 X::copy(s, p, n) only required p not
in [ss + n), which is too weak[1] requires [pp + n) and
[ss + n) not to overlap
  1. ↑ [pp + n) and [ss + n) can overlap, using std::memcpy to implement X::copy results in undefined behavior in this case.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4