basic_string Reads a single line from the input stream is
New members

These members are not defined in the Random Access Container and Sequence: requirements, but are specific to basic_string.

Member Description
static const size_type npos The largest possible value of type size_type. That is, size_type(-1).
size_type length() const Equivalent to size().
size_type capacity() const Number of elements for which memory has been allocated. That is, the size to which the string can grow before memory must be reallocated. capacity() is always greater than or equal to size().
const charT* c_str() const Returns a pointer to a null-terminated array of characters representing the string's contents. For any string s it is guaranteed that the first s.size() characters in the array pointed to by s.c_str() are equal to the character in s, and that s.c_str()[s.size()] is a null character. Note, however, that it not necessarily the first null character. Characters within a string are permitted to be null.
const charT* data() const Returns a pointer to an array of characters, not necessarily null-terminated, representing the string's contents. data() is permitted, but not required, to be identical to c_str(). The first size() characters of that array are guaranteed to be identical to the characters in *this. The return value of data() is never a null pointer, even if size() is zero.
basic_string(const basic_string& s, size_type pos = 0, size_type n = npos) Constructs a string from a substring of s. The substring begins at character position pos and terminates at character position pos + n or at the end of s, whichever comes first. This constructor throws out_of_range if pos > s.size(). Note that when pos and n have their default values, this is just a copy constructor.
basic_string(const charT* s) Equivalent to basic_string(s, s + traits::length(s)) .
basic_string(const charT* s, size_type n) Equivalent to basic_string(s, s + n).
basic_string& operator=(const charT* s) Equivalent to operator=(basic_string(s)).
basic_string& operator=(charT c) Assigns to *this a string whose size is 1 and whose contents is the single character c.
void reserve(size_t n) Requests that the string's capacity be changed; the postcondition for this member function is that, after it is called, capacity() >= n. You may request that a string decrease its capacity by calling reserve() with an argument less than the current capacity. (If you call reserve() with an argument less than the string's size, however, the capacity will only be reduced to size(). A string's size can never be greater than its capacity.) reserve() throws length_error if n > max_size().
basic_string& insert(size_type pos, const basic_string& s) If pos > size(), throws out_of_range. Otherwise, equivalent to insert(begin() + pos, s.begin(), s.end()).
basic_string& insert(size_type pos, const basic_string& s, size_type pos1, size_type n) If pos > size() or pos1 > s.size() , throws out_of_range. Otherwise, equivalent to insert(begin() + pos, s.begin() + pos1, s.begin() + pos1 + min(n, s.size() – pos1)).
basic_string& insert(size_type pos, const charT* s) If pos > size(), throws out_of_range. Otherwise, equivalent to insert(begin() + pos, s, s +
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату