I noticed something when trying to use the stringstream object. Here is a useless example to explain this:
stringstream ss ;
ss << "my string" ;
cout << ss.str() << endl ;
Is not equivalent to
cout << (stringstream() << "my string").str() << endl ;
This leads to a compilation error complaining that ‘class std::basic_ostream’ has no member named ‘str’.
I can't easily explain this. This is not critical for my application but I'm pretty sure this is hiding a c++ trick interesting to be understood.
Note: i'm using gcc with c++14