More Assignment Methods
In addition to the basic assignment operator, the string class provides assign() methods, which allow you to assign a whole string or a part of a string or a sequence of identical characters to a string object. Here are the prototypes for the various assign() methods:
basic_string& assign(const basic_string& str);basic string& assign(basic_string&& str) noexcept; // C++11basic_string& assign(const basic_string& str, size_type pos, size_type n);basic_string& assign(const charT* s, size_type n);basic_string& assign(const charT* s);basic_string& assign(size_type n, charT c); // assign n copies of ctemplate<class InputIterator> basic_string& assign(InputIterator first, InputIterator last);basic_string& ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access