jeudi 3 décembre 2015

Compare content of std::stringstream

I have two std::stringstream: ss1 and ss2, which are given as an argument to two different functions that fills them with data.

I want to sanity check that these functions writes the same content. How do I test for equality of two std::stringstream?

alg1.print(ss1);
alg2.print(ss2);

if(ss1 != ss2) {
   cout << "Content not identical!" << endl;
}

Does not work. Converting them both to str() works, however this seems ineffective. There must be a better way?

Aucun commentaire:

Enregistrer un commentaire