I am using GCC 4.0 on FC4.
Here is my problem.
I have a test function:
void test(string& s)
{
}
I can call this function with a string var:
string s("abc");
test(s);
But I cannot do this:
test(string("abc"));
But MS C/C++ compiler (Visual C++ Toolkit) compiles the above code with no
problem.
I thought it was acceptable - but it is not.
However, if I declare the parameter to be const, like this:
void (const string& s)
Then I can do test(string("abc")) and EVEN test("abc")!
I *tried* to read through the C++ standard draft, but did not get any
anwsers out of it.
Please somebody explain why. Thanks.