![]() These objects are automatically constructed from initializer list declarators.ĬharT is basic_string's character type (i.e., its first template parameter). ![]() The function template argument InputIterator shall be an input iterator type that points to elements of a type convertible to charT. The range used is [first,last), which includes all the characters between first and last, including the character pointed by first but not the character pointed by last. first, last Input iterators to the initial and final positions in a range. s Pointer to an array of characters (such as a c-string). Sublen Length of the substring to be copied (if the string is shorter, as many characters as possible are copied).Ī value of basic_string::npos indicates all characters until the end of str. If this is greater than str's length, it throws out_of_range. subpos Position of the first character in str that is copied to the object as replacement. Len Number of characters to replace (if the string is shorter, as many characters as possible are replaced).Ī value of basic_string::npos indicates all characters until the end of the string. If this is greater than the string length, it throws out_of_range. Pos Position of the first character to be replaced. ![]() Parameters str Another basic_string object of the same type (with the same class template arguments charT, traits and Alloc), whose value is copied. (7) initializer list Copies each of the characters in il, in the same order. (6) range Copies the sequence of characters in the range [first,last), in the same order. (5) fill Replaces the portion of the string by n consecutive copies of character c. (4) buffer Copies the first n characters from the array of characters pointed by s. The length is determined by calling traits.length(s). (3) c-string Copies the null-terminated character sequence (C-string) pointed by s. (2) substring Copies the portion of str that begins at the character position subpos and spans sublen characters (or until the end of str, if either str is too short or if sublen is basic_string::npos). ![]() Replaces the portion of the string that begins at character pos and spans len characters (or the part of the string in the range between [i1,i2)) by new contents: Template basic_string& replace (const_iterator i1, const_iterator i2, InputIterator first, InputIterator last) īasic_string& replace (const_iterator i1, const_iterator i2, initializer_list il) īasic_string& replace (size_type pos, size_type len, const basic_string& str, size_type subpos, size_type sublen = npos) Basic_string& replace (size_type pos, size_type len, const basic_string& str) basic_string& replace (const_iterator i1, const_iterator i2, const basic_string& str) īasic_string& replace (size_type pos, size_type len, const basic_string& str, size_type subpos, size_type sublen) īasic_string& replace (size_type pos, size_type len, const charT* s) basic_string& replace (const_iterator i1, const_iterator i2, const charT* s) īasic_string& replace (size_type pos, size_type len, const charT* s, size_type n) basic_string& replace (const_iterator i1, const_iterator i2, const charT* s, size_type n) īasic_string& replace (size_type pos, size_type len, size_type n, charT c) basic_string& replace (const_iterator i1, const_iterator i2, size_type n, charT c)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |