#include <string>
Inheritance diagram for std::basic_string< CharT, Traits, Alloc >:
Public Member Functions | |
basic_string () | |
Default constructor creates an empty string. | |
basic_string (const Alloc &a) | |
Construct an empty string using allocator a. | |
basic_string (const basic_string &str) | |
Construct string with copy of value of str. | |
basic_string (const basic_string &str, size_type position, size_type n=npos) | |
Construct string as copy of a substring. | |
basic_string (const basic_string &str, size_type position, size_type n, const Alloc &a) | |
Construct string as copy of a substring. | |
basic_string (const CharT *s, size_type n, const Alloc &a=Alloc()) | |
Construct string initialized by a character array. | |
basic_string (const CharT *s, const Alloc &a=Alloc()) | |
Construct string as copy of a C string. | |
basic_string (size_type n, CharT c, const Alloc &a=Alloc()) | |
Construct string as multiple characters. | |
template<class InputIterator> | basic_string (InputIterator __beg, InputIterator __end, const Alloc &a=Alloc()) |
Construct string as copy of a range. | |
~basic_string () | |
Destroy the string instance. | |
basic_string & | operator= (const basic_string &str) |
Assign the value of str to this string. | |
basic_string & | operator= (const CharT *s) |
Copy contents of s into this string. | |
basic_string & | operator= (CharT c) |
Set value to string of length 1. | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
size_type | size () const |
Returns the number of characters in the string, not including any null-termination. | |
size_type | length () const |
Returns the number of characters in the string, not including any null-termination. | |
size_type | max_size () const |
Returns the size() of the largest possible string. | |
void | resize (size_type n, CharT c) |
Resizes the string to the specified number of characters. | |
void | resize (size_type n) |
Resizes the string to the specified number of characters. | |
size_type | capacity () const |
void | reserve (size_type __res_arg=0) |
Attempt to preallocate enough memory for specified number of characters. | |
void | clear () |
bool | empty () const |
const_reference | operator[] (size_type position) const |
Subscript access to the data contained in the string. | |
reference | operator[] (size_type position) |
Subscript access to the data contained in the string. | |
const_reference | at (size_type n) const |
Provides access to the data contained in the string. | |
reference | at (size_type n) |
Provides access to the data contained in the string. | |
basic_string & | operator+= (const basic_string &str) |
Append a string to this string. | |
basic_string & | operator+= (const CharT *s) |
Append a C string. | |
basic_string & | operator+= (CharT c) |
Append a character. | |
basic_string & | append (const basic_string &str) |
Append a string to this string. | |
basic_string & | append (const basic_string &str, size_type position, size_type n) |
Append a substring. | |
basic_string & | append (const CharT *s, size_type n) |
Append a C substring. | |
basic_string & | append (const CharT *s) |
Append a C string. | |
basic_string & | append (size_type n, CharT c) |
Append multiple characters. | |
template<class InputIterator> basic_string & | append (InputIterator first, InputIterator last) |
Append a range of characters. | |
void | push_back (CharT c) |
Append a single character. | |
basic_string & | assign (const basic_string &str) |
Set value to contents of another string. | |
basic_string & | assign (const basic_string &str, size_type position, size_type n) |
Set value to a substring of a string. | |
basic_string & | assign (const CharT *s, size_type n) |
Set value to a C substring. | |
basic_string & | assign (const CharT *s) |
Set value to contents of a C string. | |
basic_string & | assign (size_type n, CharT c) |
Set value to multiple characters. | |
template<class InputIterator> basic_string & | assign (InputIterator first, InputIterator last) |
Set value to a range of characters. | |
void | insert (iterator __p, size_type n, CharT c) |
Insert multiple characters. | |
template<class InputIterator> void | insert (iterator __p, InputIterator __beg, InputIterator __end) |
Insert a range of characters. | |
basic_string & | insert (size_type position1, const basic_string &str) |
Insert value of a string. | |
basic_string & | insert (size_type position1, const basic_string &str, size_type position2, size_type n) |
Insert a substring. | |
basic_string & | insert (size_type position, const CharT *s, size_type n) |
Insert a C substring. | |
basic_string & | insert (size_type position, const CharT *s) |
Insert a C string. | |
basic_string & | insert (size_type position, size_type n, CharT c) |
Insert multiple characters. | |
iterator | insert (iterator __p, CharT c) |
Insert one character. | |
basic_string & | erase (size_type position=0, size_type n=npos) |
Remove characters. | |
iterator | erase (iterator position) |
Remove one character. | |
iterator | erase (iterator first, iterator last) |
Remove a range of characters. | |
basic_string & | replace (size_type position, size_type n, const basic_string &str) |
Replace characters with value from another string. | |
basic_string & | replace (size_type position1, size_type n1, const basic_string &str, size_type position2, size_type n2) |
Replace characters with value from another string. | |
basic_string & | replace (size_type position, size_type n1, const CharT *s, size_type n2) |
Replace characters with value of a C substring. | |
basic_string & | replace (size_type position, size_type n1, const CharT *s) |
Replace characters with value of a C string. | |
basic_string & | replace (size_type position, size_type n1, size_type n2, CharT c) |
Replace characters with multiple characters. | |
basic_string & | replace (iterator __i1, iterator __i2, const basic_string &str) |
Replace range of characters with string. | |
basic_string & | replace (iterator __i1, iterator __i2, const CharT *s, size_type n) |
Replace range of characters with C substring. | |
basic_string & | replace (iterator __i1, iterator __i2, const CharT *s) |
Replace range of characters with C string. | |
basic_string & | replace (iterator __i1, iterator __i2, size_type n, CharT c) |
Replace range of characters with multiple characters. | |
template<class InputIterator> basic_string & | replace (iterator __i1, iterator __i2, InputIterator __k1, InputIterator __k2) |
Replace range of characters with range. | |
size_type | copy (CharT *s, size_type n, size_type position=0) const |
Copy substring into C string. | |
void | swap (basic_string &s) |
Swap contents with another string. | |
const CharT * | c_str () const |
Return const pointer to null-terminated contents. | |
const CharT * | data () const |
Return const pointer to contents. | |
allocator_type | get_allocator () const |
Return copy of allocator used to construct this string. | |
size_type | find (const CharT *s, size_type position, size_type n) const |
Find position of a C substring. | |
size_type | find (const basic_string &str, size_type position=0) const |
Find position of a string. | |
size_type | find (const CharT *s, size_type position=0) const |
Find position of a C string. | |
size_type | find (CharT c, size_type position=0) const |
Find position of a character. | |
size_type | rfind (const basic_string &str, size_type position=npos) const |
Find last position of a string. | |
size_type | rfind (const CharT *s, size_type position, size_type n) const |
Find last position of a C substring. | |
size_type | rfind (const CharT *s, size_type position=npos) const |
Find last position of a C string. | |
size_type | rfind (CharT c, size_type position=npos) const |
Find last position of a character. | |
size_type | find_first_of (const basic_string &str, size_type position=0) const |
Find position of a character of string. | |
size_type | find_first_of (const CharT *s, size_type position, size_type n) const |
Find position of a character of C substring. | |
size_type | find_first_of (const CharT *s, size_type position=0) const |
Find position of a character of C string. | |
size_type | find_first_of (CharT c, size_type position=0) const |
Find position of a character. | |
size_type | find_last_of (const basic_string &str, size_type position=npos) const |
Find last position of a character of string. | |
size_type | find_last_of (const CharT *s, size_type position, size_type n) const |
Find last position of a character of C substring. | |
size_type | find_last_of (const CharT *s, size_type position=npos) const |
Find last position of a character of C string. | |
size_type | find_last_of (CharT c, size_type position=npos) const |
Find last position of a character. | |
size_type | find_first_not_of (const basic_string &str, size_type position=0) const |
Find position of a character not in string. | |
size_type | find_first_not_of (const CharT *s, size_type position, size_type n) const |
Find position of a character not in C substring. | |
size_type | find_first_not_of (const CharT *s, size_type position=0) const |
Find position of a character not in C string. | |
size_type | find_first_not_of (CharT c, size_type position=0) const |
Find position of a different character. | |
size_type | find_last_not_of (const basic_string &str, size_type position=npos) const |
Find last position of a character not in string. | |
size_type | find_last_not_of (const CharT *s, size_type position, size_type n) const |
Find last position of a character not in C substring. | |
size_type | find_last_not_of (const CharT *s, size_type position=npos) const |
Find position of a character not in C string. | |
size_type | find_last_not_of (CharT c, size_type position=npos) const |
Find last position of a different character. | |
basic_string | substr (size_type position=0, size_type n=npos) const |
Get a substring. | |
int | compare (const basic_string &str) const |
Compare to a string. | |
int | compare (size_type position, size_type n, const basic_string &str) const |
Compare substring to a string. | |
int | compare (size_type position1, size_type n1, const basic_string &str, size_type position2, size_type n2) const |
Compare substring to a substring. | |
int | compare (const CharT *s) const |
Compare to a C string. | |
int | compare (size_type position, size_type n1, const CharT *s) const |
Compare substring to a C string. | |
int | compare (size_type position, size_type n1, const CharT *s, size_type n2) const |
Compare substring against a character array. | |
Static Public Attributes | |
const size_type | npos |
Value returned by various member functions when they fail. |
Meets the requirements of a container, a reversible container, and a sequence. Of the optional sequence requirements, only push_back
, at
, and array access are supported.
Definition at line 111 of file basic_string.h.
|
Default constructor creates an empty string. Definition at line 1970 of file basic_string.h. Referenced by std::basic_string< char >::substr(). |
|
Construct an empty string using allocator a. Definition at line 188 of file basic_string.tcc. |
|
Construct string with copy of value of str.
|
|
Construct string as copy of a substring.
|
|
Construct string as copy of a substring.
|
|
Construct string initialized by a character array.
|
|
Construct string as copy of a C string.
|
|
Construct string as multiple characters.
|
|
Construct string as copy of a range.
|
|
Destroy the string instance. Definition at line 414 of file basic_string.h. |
|
Append a range of characters.
|
|
Append multiple characters.
|
|
Append a C string.
|
|
Append a C substring.
References std::basic_string< CharT, Traits, Alloc >::capacity(), std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Append a substring.
References std::basic_string< CharT, Traits, Alloc >::capacity(), std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Append a string to this string.
References std::basic_string< CharT, Traits, Alloc >::capacity(), std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::size(). Referenced by std::basic_string< char >::append(), std::collate< CharT >::do_transform(), std::getline(), std::operator+(), std::basic_string< char >::operator+=(), std::operator>>(), and std::basic_string< CharT, Traits, Alloc >::resize(). |
|
Set value to a range of characters.
|
|
Set value to multiple characters.
|
|
Set value to contents of a C string.
|
|
Set value to a C substring.
References std::copy(), std::basic_string< CharT, Traits, Alloc >::max_size(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Set value to a substring of a string.
|
|
Set value to contents of another string.
References std::basic_string< CharT, Traits, Alloc >::get_allocator(). Referenced by std::basic_string< char >::assign(), std::money_get< CharT, InIter >::do_get(), and std::basic_string< char >::operator=(). |
|
Provides access to the data contained in the string.
|
|
Provides access to the data contained in the string.
|
|
Returns a read-only (constant) iterator that points to the first character in the string. Definition at line 470 of file basic_string.h. |
|
Returns a read/write iterator that points to the first character in the string. Unshares the string. Definition at line 459 of file basic_string.h. |
|
Return const pointer to null-terminated contents. This is a handle to internal data. Do not modify or dire things may happen. Definition at line 1453 of file basic_string.h. Referenced by std::money_get< CharT, InIter >::do_get(), std::num_get< CharT, InIter >::do_get(), std::collate< CharT >::do_transform(), std::locale::global(), and std::locale::locale(). |
|
Returns the total number of characters that the string can hold before needing to allocate more memory. Definition at line 575 of file basic_string.h. Referenced by std::basic_string< CharT, Traits, Alloc >::append(), and std::basic_string< CharT, Traits, Alloc >::reserve(). |
|
Erases the string, making it empty. Definition at line 601 of file basic_string.h. |
|
Compare substring against a character array.
NB: s must have at least n2 characters, '' has no special meaning. Definition at line 919 of file basic_string.tcc. References std::min(). |
|
Compare substring to a C string.
References std::min(). |
|
Compare to a C string.
References std::min(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Compare substring to a substring.
References std::basic_string< CharT, Traits, Alloc >::data(), and std::min(). |
|
Compare substring to a string.
References std::basic_string< CharT, Traits, Alloc >::data(), std::min(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Compare to a string.
Referenced by std::operator!=(), std::operator<(), std::operator<=(), std::operator==(), std::operator>(), and std::operator>=(). |
|
Copy substring into C string.
References std::copy(). |
|
Return const pointer to contents. This is a handle to internal data. Do not modify or dire things may happen. Definition at line 1462 of file basic_string.h. Referenced by std::basic_string< CharT, Traits, Alloc >::compare(), std::basic_string< char >::compare(), std::money_get< CharT, InIter >::do_get(), std::collate< CharT >::do_transform(), std::basic_string< char >::find(), std::basic_string< char >::find_first_not_of(), std::basic_string< char >::find_first_of(), std::basic_string< char >::find_last_not_of(), std::basic_string< char >::find_last_of(), std::locale::operator()(), and std::basic_string< char >::rfind(). |
|
Returns true if the string is empty. Equivalent to *this == "". Definition at line 607 of file basic_string.h. Referenced by std::operator>>(). |
|
Returns a read-only (constant) iterator that points one past the last character in the string. Definition at line 489 of file basic_string.h. |
|
Returns a read/write iterator that points one past the last character in the string. Unshares the string. Definition at line 478 of file basic_string.h. Referenced by std::locale::locale(). |
|
Remove a range of characters.
|
|
Remove one character.
|
|
Remove characters.
Referenced by std::getline(), std::locale::locale(), std::operator>>(), and std::basic_string< CharT, Traits, Alloc >::resize(). |
|
Find position of a character.
References std::find(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a C string.
|
|
Find position of a string.
|
|
Find position of a C substring.
References std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). Referenced by std::basic_string< char >::find(), and std::basic_string< char >::find_first_of(). |
|
Find position of a different character.
References std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in C string.
|
|
Find position of a character not in C substring.
References std::find(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in string.
Referenced by std::basic_string< char >::find_first_not_of(). |
|
Find position of a character.
Note: equivalent to find(c, pos). Definition at line 1644 of file basic_string.h. |
|
Find position of a character of C string.
|
|
Find position of a character of C substring.
References std::find(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character of string.
Referenced by std::basic_string< char >::find_first_of(). |
|
Find last position of a different character.
References std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in C string.
|
|
Find last position of a character not in C substring.
References std::find(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a character not in string.
Referenced by std::basic_string< char >::find_last_not_of(). |
|
Find last position of a character.
Note: equivalent to rfind(c, pos). Definition at line 1705 of file basic_string.h. |
|
Find last position of a character of C string.
|
|
Find last position of a character of C substring.
References std::find(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a character of string.
Referenced by std::basic_string< char >::find_last_of(). |
|
Return copy of allocator used to construct this string. Definition at line 1468 of file basic_string.h. Referenced by std::basic_string< CharT, Traits, Alloc >::assign(), std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::swap(). |
|
Insert one character.
|
|
Insert multiple characters.
|
|
Insert a C string.
|
|
Insert a C substring.
References std::copy(), std::basic_string< CharT, Traits, Alloc >::max_size(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Insert a substring.
|
|
Insert value of a string.
|
|
Insert a range of characters.
|
|
Insert multiple characters.
Referenced by std::basic_string< char >::insert(). |
|
Returns the number of characters in the string, not including any null-termination. Definition at line 538 of file basic_string.h. Referenced by std::collate< CharT >::do_transform(), and std::locale::operator()(). |
|
Returns the size() of the largest possible string. Definition at line 542 of file basic_string.h. Referenced by std::basic_string< CharT, Traits, Alloc >::assign(), std::getline(), std::basic_string< CharT, Traits, Alloc >::insert(), std::operator>>(), std::basic_string< CharT, Traits, Alloc >::replace(), std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::resize(). |
|
Append a character.
|
|
Append a C string.
|
|
Append a string to this string.
|
|
Set value to string of length 1.
|
|
Copy contents of s into this string.
|
|
Assign the value of str to this string.
|
|
Subscript access to the data contained in the string.
|
|
Subscript access to the data contained in the string.
|
|
Append a single character.
Referenced by std::collate< CharT >::do_transform(), and std::operator>>(). |
|
Returns a read-only (constant) reverse iterator that points to the last character in the string. Iteration is done in reverse element order. Definition at line 507 of file basic_string.h. |
|
Returns a read/write reverse iterator that points to the last character in the string. Iteration is done in reverse element order. Unshares the string. Definition at line 498 of file basic_string.h. |
|
Returns a read-only (constant) reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. Definition at line 525 of file basic_string.h. |
|
Returns a read/write reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. Unshares the string. Definition at line 516 of file basic_string.h. |
|
Replace range of characters with range.
|
|
Replace range of characters with multiple characters.
|
|
Replace range of characters with C string.
|
|
Replace range of characters with C substring.
|
|
Replace range of characters with string.
|
|
Replace characters with multiple characters.
|
|
Replace characters with value of a C string.
|
|
Replace characters with value of a C substring.
References std::copy(), std::basic_string< CharT, Traits, Alloc >::max_size(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Replace characters with value from another string.
|
|
Replace characters with value from another string.
Referenced by std::basic_string< char >::append(), std::basic_string< char >::assign(), std::basic_string< char >::insert(), and std::basic_string< char >::replace(). |
|
Attempt to preallocate enough memory for specified number of characters.
The advantage of this function is that if optimal code is a necessity and the user can determine the string length that will be required, the user can reserve the memory in advance, and thus prevent a possible reallocation of memory and copying of string data. Definition at line 418 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::capacity(), std::basic_string< CharT, Traits, Alloc >::get_allocator(), std::basic_string< CharT, Traits, Alloc >::max_size(), and std::basic_string< CharT, Traits, Alloc >::size(). Referenced by std::basic_string< CharT, Traits, Alloc >::append(), std::num_get< CharT, InIter >::do_get(), std::operator+(), and std::operator>>(). |
|
Resizes the string to the specified number of characters.
|
|
Resizes the string to the specified number of characters.
References std::basic_string< CharT, Traits, Alloc >::append(), std::basic_string< CharT, Traits, Alloc >::erase(), std::basic_string< CharT, Traits, Alloc >::max_size(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a character.
References std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a C string.
|
|
Find last position of a C substring.
References std::min(), std::basic_string< CharT, Traits, Alloc >::npos, and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a string.
Referenced by std::basic_string< char >::find_last_of(), and std::basic_string< char >::rfind(). |
|
|
Get a substring.
|
|
Swap contents with another string.
References std::basic_string< CharT, Traits, Alloc >::get_allocator(). |
|
Value returned by various member functions when they fail. Definition at line 70 of file basic_string.tcc. Referenced by std::basic_string< CharT, Traits, Alloc >::find(), std::basic_string< CharT, Traits, Alloc >::find_first_not_of(), std::basic_string< CharT, Traits, Alloc >::find_first_of(), std::basic_string< CharT, Traits, Alloc >::find_last_not_of(), std::basic_string< CharT, Traits, Alloc >::find_last_of(), and std::basic_string< CharT, Traits, Alloc >::rfind(). |