Namespaces
Variants
Views
Actions

std::basic_string

From cppreference.com
< cpp‎ | string
Revision as of 16:35, 4 May 2012 by P12bot (Talk | contribs)

Template:cpp/string/basic string/sidebar

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: Template:tdcl list begin Template:tdcl list header Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list end

Contents

Member types

Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list template Template:tdcl list end

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 lengthTemplate: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 cmpTemplate:cpp/string/basic string/dcl list swap2Template: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
concatenates two strings or a string and a char
(function template)
Input/output
performs stream I/O on strings
(function template)
read data from an I/O stream into a string
(function)
Numeric conversions

Helper classes

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