The following code:
std::stringstream test;
std::streamsize dataSize;
test << "";
dataSize = test.rdbuf()->in_avail();
cout << "Available character: " << dataSize << ", while using string: " << test.str() << std::endl;
test << "A";
dataSize = test.rdbuf()->in_avail();
cout << "Available character: " << dataSize << ", while using string: " << test.str() << std::endl;
test << " bigger string";
dataSize = test.rdbuf()->in_avail();
cout << "Available character: " << dataSize << ", while using string: " << test.str() << std::endl;
Outputs this:
Available character: 0, while using string:
Available character: 1, while using string: A
Available character: 1, while using string: A bigger string
However, according to:
http://www.cplusplus.com/reference/streambuf/streambuf/in_avail/
The last output should indicate that the stringstream is 15 character long.
Is this a bug in gcc (I am using 5.4.0 in Ubuntu 16.04)