I have some code that, in its smallest complete form that exhibits the problem (being a good citizen when it comes to asking questions), basically boils down to the following:
#include <string>
#include <iostream>
int main (void) {
int x = 11;
std::string s = "Value was: " + x;
std::cout << "[" << s << "]" << std::endl;
return 0;
}
and I'm expecting it to output
[Value was: 11]
Instead, instead of that, I'm getting just:
[]
Why is that? Why can I not output my string? Is the string blank? Is cout
somehow broken? Have I gone mad?
<string>
for this to "work" in a compliant manner, by the way. – Templasgcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
compiles that without errors - maybe it's just forgiving. In any case, adding string doesn't help so I'll add it to the question so we're more kosher. However, Xeo beat me to it so thanks :-) – Reisman