It's been a long time since I've done some significant C++, and I just bumped into something that strikes me as weird. (We're using Visual C++ 6.)
Short form of the question: what's the difference between the two variable declarations
I thought they'd both create a local variable of the stringstream type, constructed with the default constructor, but there's something else happening.
I've got a class with a member function prototyped as:
If I use the two above variable declarations....
I don't understand why the two statements differ, and my Google-fu is apparently weak. Can someone explain this to me?
Thanks!
Short form of the question: what's the difference between the two variable declarations
Code:
std::stringstream foo;
std::stringstream bar();
I've got a class with a member function prototyped as:
Code:
void Store (std::ostream &Stream);
Code:
thing->Store(foo); //compiles OK, works
thing->Store(bar); //compile error: "cannot convert parameter 1 from [blah] to [blah]. Context does not allow for disambiguation of overloaded function."
Thanks!