Namespaces
Variants
Actions

std::basic_string

From cppreference.com
< User:Nate‎ | rev
 
 
 
std::basic_string
 
Defined in header <string>
template<

    class CharT,
    class Traits = std::char_traits<CharT>,
    class Allocator = std::allocator<CharT>

> class basic_string;

The class template basic_string stores and manipulates sequences of char-like objects (that is, objects for which a specialization of std::char_traits or compatible traits class is provided).

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)

Several specializations 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::u16string (C++11) std::basic_string<char16_t>
std::u32string (C++11) std::basic_string<char32_t>

Contents

Member types

Template:cpp/container/dcl list allocator typeTemplate:cpp/container/dcl list size typeTemplate:cpp/container/dcl list difference typeTemplate:cpp/container/dcl list referenceTemplate:cpp/container/dcl list const referenceTemplate:cpp/container/dcl list pointerTemplate:cpp/container/dcl list const pointerTemplate:cpp/container/dcl list iteratorTemplate:cpp/container/dcl list const iteratorTemplate:cpp/container/dcl list reverse iteratorTemplate:cpp/container/dcl list const reverse iterator
Member type Definition
traits_type Traits
value_type Traits::char_type

Member functions

Template:cpp/string/basic string/dcl list constructorTemplate:cpp/string/basic string/dcl list operator=Template:cpp/string/basic string/dcl list assignTemplate:cpp/string/basic string/dcl list get allocatorTemplate:cpp/string/basic string/dcl list atTemplate:cpp/string/basic string/dcl list operator atTemplate:cpp/string/basic string/dcl list frontTemplate:cpp/string/basic string/dcl list backTemplate:cpp/string/basic string/dcl list dataTemplate:cpp/string/basic string/dcl list c strTemplate:cpp/string/basic string/dcl list beginTemplate:cpp/string/basic string/dcl list endTemplate:cpp/string/basic string/dcl list rbeginTemplate:cpp/string/basic string/dcl list rendTemplate:cpp/string/basic string/dcl list emptyTemplate:cpp/string/basic string/dcl list sizeTemplate:cpp/string/basic string/dcl list max sizeTemplate:cpp/string/basic string/dcl list reserveTemplate:cpp/string/basic string/dcl list capacityTemplate:cpp/string/basic string/dcl list shrink to fitTemplate:cpp/string/basic string/dcl list clearTemplate:cpp/string/basic string/dcl list insertTemplate:cpp/string/basic string/dcl list eraseTemplate:cpp/string/basic string/dcl list push backTemplate:cpp/string/basic string/dcl list pop backTemplate:cpp/string/basic string/dcl list appendTemplate:cpp/string/basic string/dcl list operator+=Template:cpp/string/basic string/dcl list compareTemplate:cpp/string/basic string/dcl list replaceTemplate:cpp/string/basic string/dcl list substrTemplate:cpp/string/basic string/dcl list copyTemplate:cpp/string/basic string/dcl list resizeTemplate:cpp/string/basic string/dcl list swapTemplate:cpp/string/basic string/dcl list findTemplate:cpp/string/basic string/dcl list rfindTemplate:cpp/string/basic string/dcl list find first ofTemplate:cpp/string/basic string/dcl list find first not ofTemplate:cpp/string/basic string/dcl list find last ofTemplate:cpp/string/basic string/dcl list find last not ofTemplate:cpp/string/basic string/dcl list npos
Element access
Iterators
Capacity
Operations
Search

Constants

Non-member functions

Template:cpp/string/basic string/dcl list operator+Template:cpp/string/basic string/dcl list operator cmpTemplate:cpp/string/basic string/dcl list swap2Template:cpp/string/basic string/dcl list operator ltltgtgtTemplate:cpp/string/basic string/dcl list getlineTemplate:cpp/string/basic string/dcl list stolTemplate:cpp/string/basic string/dcl list stoulTemplate:cpp/string/basic string/dcl list stofTemplate:cpp/string/basic string/dcl list to stringTemplate:cpp/string/basic string/dcl list to wstring
Input/output
Numeric conversions

Helper classes

Template:cpp/string/basic string/dcl list hash