Hello,
I have problems understanding why the following example does not compile in
VC7.1:
std::stringstre am test;
const std::istream& test2 = test; //OK
const std::istream& test3 = std::stringstre am(); // fails
Error is:
'std::basic_str ingstream<_Elem ,_Traits,_Alloc >::__ctor' : no non-explicit
constructor available for implicit conversion
I used to think test + test2 lines and test3 lines are equivalent but it
seems not. Any ideas?
Note: I know that test3 line will lead to undefined behaviour, but I would
like to know why it does not compile?
Thanks in advance,
SerGioGioGio
I have problems understanding why the following example does not compile in
VC7.1:
std::stringstre am test;
const std::istream& test2 = test; //OK
const std::istream& test3 = std::stringstre am(); // fails
Error is:
'std::basic_str ingstream<_Elem ,_Traits,_Alloc >::__ctor' : no non-explicit
constructor available for implicit conversion
I used to think test + test2 lines and test3 lines are equivalent but it
seems not. Any ideas?
Note: I know that test3 line will lead to undefined behaviour, but I would
like to know why it does not compile?
Thanks in advance,
SerGioGioGio
Comment