Announcements and Reminders
|
RecordingComments on Assignment 2
The string classtypedef basic_string<char> string; Constructorsstring(); string(const char* str); string(const str& str); string(const string& str, size_t pos, size_t len=npos); string(const char* s, size_t n); string(size_t n, char c); template <class InputIterator> string(InputIterator first,InputIterator last); string(initializer list<char> il); string(string&& str); Example 5-1 – string constructors Iterator FunctionsCapacity FunctionsAccess FunctionsModifier FunctionsSearch FunctionsOperation FunctionsNon-member Functionsgetline istream& getline(istream& is, string& str, char delim); istream& getline(istream& is, string& str); swap void swap(string& x, string& y); Example 5-8 – Non-member string functions Member Operatorsoperator= operator[] operator+= Non-member OperatorsMember Constantnpos npos is a static member constant, equal to the maximum value for type, size_t. It is used to indicate the location beyond the length of a string, or with use of a find function, the return value, not found. static const size_t npos = -1; The stringstream classesistringstreamostringstreamstringstream |