May 2018
Intermediate to advanced
328 pages
8h 15m
English
Two overloads called join_strings() are listed in the following code. One takes a container of strings and a pointer to a sequence of characters representing a separator, while the other takes two random access iterators, representing the first and one past the last element of a range, and a separator. They both return a new string created by concatenating all the input strings, using an output string stream and the std::copy function. This general-purpose function copies all the elements in the specified range to an output range, represented by an output iterator. We are using here an std::ostream_iterator that uses operator<< to write the assigned value to the specified output stream ...
Read now
Unlock full access