#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 |
null-termination. | |
size_type | length () const |
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. |
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 110 of file basic_string.h.
|
Default constructor creates an empty string.
Definition at line 1972 of file basic_string.h. Referenced by std::basic_string< char >::substr(). |
|
Construct an empty string using allocator a.
Definition at line 192 of file basic_string.tcc. |
|
Construct string with copy of value of str.
Definition at line 184 of file basic_string.tcc. |
|
Construct string as copy of a substring.
Definition at line 198 of file basic_string.tcc. |
|
Construct string as copy of a substring.
Definition at line 208 of file basic_string.tcc. |
|
Construct string initialized by a character array.
Definition at line 220 of file basic_string.tcc. |
|
Construct string as copy of a C string.
Definition at line 227 of file basic_string.tcc. |
|
Construct string as multiple characters.
Definition at line 234 of file basic_string.tcc. |
|
Construct string as copy of a range.
Definition at line 242 of file basic_string.tcc. |
|
Destroy the string instance.
Definition at line 417 of file basic_string.h. |
|
Append a range of characters.
Definition at line 777 of file basic_string.h. |
|
Append multiple characters.
Definition at line 764 of file basic_string.h. |
|
Append a C string.
Definition at line 749 of file basic_string.h. |
|
Append a C substring.
Definition at line 636 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Append a substring.
Definition at line 619 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::reserve(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Append a string to this string.
Definition at line 603 of file basic_string.tcc. References 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.
Definition at line 866 of file basic_string.h. |
|
Set value to multiple characters.
Definition at line 853 of file basic_string.h. |
|
Set value to contents of a C string.
Definition at line 837 of file basic_string.h. |
|
Set value to a C substring.
Definition at line 265 of file basic_string.tcc. |
|
Set value to a substring of a string.
Definition at line 809 of file basic_string.h. |
|
Set value to contents of another string.
Definition at line 249 of file basic_string.tcc. 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.
Definition at line 678 of file basic_string.h. |
|
Provides access to the data contained in the string.
Definition at line 659 of file basic_string.h. |
|
Returns a read-only (constant) iterator that points to the first character in the string. Definition at line 473 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 462 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 1456 of file basic_string.h. Referenced by std::collate< CharT >::do_compare(), std::money_get< CharT, InIter >::do_get(), std::collate< CharT >::do_transform(), and std::locale::locale(). |
|
Returns the total number of characters that the string can hold before needing to allocate more memory. Definition at line 578 of file basic_string.h. |
|
Erases the string, making it empty. Definition at line 604 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 926 of file basic_string.tcc. References std::min(). |
|
Compare substring to a C string.
Definition at line 910 of file basic_string.tcc. References std::min(). |
|
Compare to a C string.
Definition at line 895 of file basic_string.tcc. References std::min(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Compare substring to a substring.
Definition at line 877 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::data(), and std::min(). |
|
Compare substring to a string.
Definition at line 862 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::data(), std::min(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Compare to a string.
Definition at line 1858 of file basic_string.h. Referenced by std::operator!=(), std::operator<(), std::operator<=(), std::operator==(), std::operator>(), and std::operator>=(). |
|
Copy substring into C string.
Definition at line 678 of file basic_string.tcc. |
|
Return const pointer to contents. This is a handle to internal data. Do not modify or dire things may happen. Definition at line 1465 of file basic_string.h. Referenced by std::basic_string< CharT, Traits, Alloc >::compare(), std::basic_string< char >::compare(), std::collate< CharT >::do_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 610 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 492 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 481 of file basic_string.h. Referenced by std::locale::locale(). |
|
Remove a range of characters.
Definition at line 1072 of file basic_string.h. |
|
Remove one character.
Definition at line 1052 of file basic_string.h. |
|
Remove characters.
Definition at line 1039 of file basic_string.h. Referenced by std::getline(), std::locale::locale(), std::operator>>(), and std::basic_string< CharT, Traits, Alloc >::resize(). |
|
Find position of a character.
Definition at line 706 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a C string.
Definition at line 1512 of file basic_string.h. |
|
Find position of a string.
Definition at line 1498 of file basic_string.h. |
|
Find position of a C substring.
Definition at line 692 of file basic_string.tcc. References 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.
Definition at line 810 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in C string.
Definition at line 1751 of file basic_string.h. |
|
Find position of a character not in C substring.
Definition at line 798 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in string.
Definition at line 1722 of file basic_string.h. Referenced by std::basic_string< char >::find_first_not_of(). |
|
Find position of a character.
Note: equivalent to find(c, pos). Definition at line 1647 of file basic_string.h. |
|
Find position of a character of C string.
Definition at line 1628 of file basic_string.h. |
|
Find position of a character of C substring.
Definition at line 762 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character of string.
Definition at line 1600 of file basic_string.h. Referenced by std::basic_string< char >::find_first_of(). |
|
Find last position of a different character.
Definition at line 842 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find position of a character not in C string.
Definition at line 1810 of file basic_string.h. |
|
Find last position of a character not in C substring.
Definition at line 821 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a character not in string.
Definition at line 1781 of file basic_string.h. 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 1708 of file basic_string.h. |
|
Find last position of a character of C string.
Definition at line 1689 of file basic_string.h. |
|
Find last position of a character of C substring.
Definition at line 777 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a character of string.
Definition at line 1661 of file basic_string.h. Referenced by std::basic_string< char >::find_last_of(). |
|
Return copy of allocator used to construct this string.
Definition at line 1471 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.
Definition at line 1015 of file basic_string.h. |
|
Insert multiple characters.
Definition at line 998 of file basic_string.h. |
|
Insert a C string.
Definition at line 975 of file basic_string.h. |
|
Insert a C substring.
Definition at line 291 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Insert a substring.
Definition at line 934 of file basic_string.h. |
|
Insert value of a string.
Definition at line 912 of file basic_string.h. |
|
Insert a range of characters.
Definition at line 897 of file basic_string.h. |
|
Insert multiple characters.
Definition at line 882 of file basic_string.h. Referenced by std::basic_string< char >::insert(). |
|
null-termination.
Definition at line 541 of file basic_string.h. Referenced by std::collate< CharT >::do_compare(), std::collate< CharT >::do_transform(), and std::locale::operator()(). |
|
Returns the size() of the largest possible string.
Definition at line 545 of file basic_string.h. Referenced by std::getline(), std::operator>>(), and std::basic_string< CharT, Traits, Alloc >::resize(). |
|
Append a character.
Definition at line 709 of file basic_string.h. |
|
Append a C string.
Definition at line 701 of file basic_string.h. |
|
Append a string to this string.
Definition at line 693 of file basic_string.h. |
|
Set value to string of length 1.
Definition at line 450 of file basic_string.h. |
|
Copy contents of s into this string.
Definition at line 436 of file basic_string.h. |
|
Assign the value of str to this string.
Definition at line 425 of file basic_string.h. |
|
Subscript access to the data contained in the string.
Definition at line 641 of file basic_string.h. |
|
Subscript access to the data contained in the string.
Definition at line 624 of file basic_string.h. |
|
Append a single character.
Definition at line 785 of file basic_string.h. 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 510 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 501 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 528 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 519 of file basic_string.h. |
|
Replace range of characters with range.
Definition at line 1288 of file basic_string.h. |
|
Replace range of characters with multiple characters.
Definition at line 1265 of file basic_string.h. |
|
Replace range of characters with C string.
Definition at line 1244 of file basic_string.h. |
|
Replace range of characters with C substring.
Definition at line 1223 of file basic_string.h. |
|
Replace range of characters with string.
Definition at line 1205 of file basic_string.h. |
|
Replace characters with multiple characters.
Definition at line 1187 of file basic_string.h. |
|
Replace characters with value of a C string.
Definition at line 1164 of file basic_string.h. |
|
Replace characters with value of a C substring.
Definition at line 326 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Replace characters with value from another string.
Definition at line 1121 of file basic_string.h. |
|
Replace characters with value from another string.
Definition at line 1099 of file basic_string.h. 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 425 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::get_allocator(), and std::basic_string< CharT, Traits, Alloc >::size(). Referenced by std::basic_string< CharT, Traits, Alloc >::append(), and std::operator>>(). |
|
Resizes the string to the specified number of characters.
Definition at line 571 of file basic_string.h. |
|
Resizes the string to the specified number of characters.
Definition at line 573 of file basic_string.tcc. 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(). Referenced by std::basic_string< char >::resize(). |
|
Find last position of a character.
Definition at line 745 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a C string.
Definition at line 1570 of file basic_string.h. |
|
Find last position of a C substring.
Definition at line 724 of file basic_string.tcc. References std::min(), and std::basic_string< CharT, Traits, Alloc >::size(). |
|
Find last position of a string.
Definition at line 1542 of file basic_string.h. Referenced by std::basic_string< char >::find_last_of(), and std::basic_string< char >::rfind(). |
|
|
Get a substring.
Definition at line 1842 of file basic_string.h. |
|
Swap contents with another string.
Definition at line 442 of file basic_string.tcc. References std::basic_string< CharT, Traits, Alloc >::get_allocator(). |