Shouldn't this be allowed? I'm using Visual Studio 2008 and getting the following error when I try using string variables with the << operator.
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion)
IE. The following does not work:
1 2
|
std::string name = "John";
std::cout << "Hello " << name << "\n";
|
I don't remember this always being the case, though I could be wrong. Is this VC's fault or mine?
Last edited on
I see no reason why that shouldn't work.