I am trying to write a code to understand usage of std::ostreambuf_iterator:
#include <string>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
int main()
{
std::cout << "Hello Boy";
std::ostreambuf_iterator<char> s2(std::cout);
std::cout << " s2 = " << *s2 << std::endl;
}
But the compilation fails stating "no operator << matches operands" - can we not use << on ostreambuf_iterator? Then how can we print the values held by the iterator?
Aucun commentaire:
Enregistrer un commentaire