lundi 11 janvier 2021

Have `std::ostreambuf_iterator` write to a string instead of `std::cout` in this example

I am going through an example of std::regex_replace. The example uses this

std::regex_replace(std::ostreambuf_iterator<char>(std::cout),source.begin(), source.end(), search, "");

std::ostreambuf_iterator<char>(std::cout) writes to std::cout how do I make it write to a string instead ?

Aucun commentaire:

Enregistrer un commentaire