On Thu, 23 Oct 2014, John Peterson wrote:

> OK, so you are saying this code
>
>> bool t = (is >> val);
>
> is legal?  (FWIW, it works with g++ -std=c++11)

I believe it's legal in C++11.  istringstream inherits operator>> from
istream; that returns a reference-to-istream.  That istream should
then happily convert via its operator bool.

I'm pretty sure about this.

I believe it's also legal in C++03 - here the istream conversion
operator goes to void*, and since I think it counts as a "user-defined
conversion" you don't get any more implicit user-defined
conversions...  but then void* to bool is a "standard conversion
sequence" so it doesn't break the "one implicit user-defined
conversion at a time" rule.

I'm much less sure about this.
---
Roy

------------------------------------------------------------------------------
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to