Rather than outputting the expected string of "Bar"
, the following code outputs what looks to be a pointer.
#include <sstream>
#include <iostream>
int main()
{
std::stringstream Foo("Bar");
std::cout << Foo << std::endl; // Outputs "0x22fe80."
return 0;
}
This can be worked around by using Foo.str()
, but it's caused some issues for me in the past. What causes this strange behavior? Where is it documented?