Standard C++ Library Class Reference
size () const;
Return the number of elements contained in this string.
basic_string
substr (size_type pos = 0, size_type n = npos) const;
Returns a string composed of copies of the lesser of n and size() characters in this string starting at index pos. Throws an
out_of_range exception if pos <= size().
void
swap (basic_string& s);
Swaps the contents of this string with the contents of s.
Non-member Operators
template<class charT, class traits, class Allocator>
basic_string
operator+ (const basic_string& lhs, const basic_string& rhs);
Returns a string of length lhs.size() + rhs.size(), where the first lhs.size() elements are copies of the elements of lhs, and
the next rhs.size() elements are copies of the elements of rhs.
template<class charT, class traits, class Allocator>
basic_string
operator+ (const charT* lhs, const basic_string& rhs);
template<class charT, class traits, class Allocator>
basic_string
operator+ (charT lhs, const basic_string& rhs);
template<class charT, class traits, class Allocator>
basic_string
operator+ (const basic_string& lhs, const charT* rhs);
template<class charT, class traits, class Allocator>
basic_string
operator+ (const basic_string& lhs, charT rhs);
Returns a string that represents the concatenation of two string-like entities. These functions return, respectively:
basic_string(lhs) + rhs
basic_string(1, lhs) + rhs
lhs + basic_string(rhs)
lhs + basic_string(1, rhs)
template<class charT, class traits, class Allocator>
bool
operator== (const basic_string& lhs, const basic_string& rhs);
Returns a boolean value of true if lhs and rhs are equal, and false if they are not. Equality is defined by the compare()
member function.
template<class charT, class traits, class Allocator>
bool
operator== (const charT* lhs, const basic_string& rhs);
template<class charT, class traits, class Allocator>
bool
operator== (const basic_string& lhs, const charT* rhs);
Returns a boolean value indicating whether lhs and rhs are equal. Equality is defined by the compare() member function.
These functions return, respectively:
basic_string(lhs) == rhs
lhs == basic_string(rhs)
template<class charT, class traits, class Allocator>
bool
operator!= (const basic_string& lhs,