std::u32string (3) - Linux Manuals
std::u32string: std::basic_string
NAME
std::basic_string - std::basic_string
Synopsis
Defined in header <string>
template<
class CharT,
class Traits = std::char_traits<CharT>, (1)
class Allocator = std::allocator<CharT>
> class basic_string;
namespace pmr {
template <class CharT, class Traits = std::char_traits<CharT>>
using basic_string = std::basic_string< CharT, Traits, (2) (since C++17)
std::polymorphic_allocator<CharT>>
}
The class template basic_string stores and manipulates sequences of char-like objects, which are non-array objects of trivial standard-layout type. The class is dependent neither on the character type nor on the nature of operations on that type. The definitions of the operations are supplied via the Traits template parameter - a specialization of std::char_traits or a compatible traits class. Traits::char_type and CharT must name the same type; otherwise the program is ill-formed.
The elements of a basic_string are stored contiguously, that is, for a basic_string s, &*(s.begin() + n) == &*s.begin() + n for any n in [0, s.size()), or, equivalently, a pointer to s[0] can be passed to functions that expect a pointer to the first element of a CharT[] array. (since C++11)
std::basic_string satisfies the requirements of AllocatorAwareContainer, SequenceContainer
and ContiguousContainer
(since C++17)
Several typedefs for common character types are provided:
Defined in header <string>
Type Definition
std::string std::basic_string<char>
std::wstring std::basic_string<wchar_t>
std::u8string (C++20) std::basic_string<char8_t>
std::u16string (C++11) std::basic_string<char16_t>
std::u32string (C++11) std::basic_string<char32_t>
std::pmr::string (C++17) std::pmr::basic_string<char>
std::pmr::wstring (C++17) std::pmr::basic_string<wchar_t>
std::pmr::u8string (C++20) std::pmr::basic_string<char8_t>
std::pmr::u16string (C++17) std::pmr::basic_string<char16_t>
std::pmr::u32string (C++17) std::pmr::basic_string<char32_t>
Template parameters
CharT - character type
Traits - traits class specifying the operations on the character type
Allocator - Allocator type used to allocate internal storage
Member types
Member type Definition
traits_type Traits
value_type CharT
allocator_type Allocator
size_type Allocator::size_type (until C++11)
difference_type Allocator::difference_type (until C++11)
reference Allocator::reference (until C++11)
const_reference Allocator::const_reference (until C++11)
pointer Allocator::pointer (until C++11)
const_pointer Allocator::const_pointer (until C++11)
iterator LegacyRandomAccessIterator
const_iterator Constant LegacyRandomAccessIterator
reverse_iterator std::reverse_iterator<iterator>
const_reverse_iterator std::reverse_iterator<const_iterator>
Member functions
constructor (public member function)
destructor (public member function)
operator= (public member function)
assign (public member function)