Closed Constellation closed 11 years ago
operator bool is libstdc++ extension. So libc++ doesn't have this feature.
Is this correct? I don't have a copy of the final ISO C++11 specification, but in 27.5.5 in n3247 these are defined as,
explicit operator bool() const;
bool operator!() const;
cf. http://en.cppreference.com/w/cpp/io/basic_ios/operator_bool
Anyway, if the current code is not compatible with libc++, I'm fine to fix these.
Is this correct?
Ah, sorry! I've checked n3337 (final draft of C++11) and found explicit operator bool
definition. Thanks for your pointing.
And I saw libc++ defines explicit operator bool
. I misunderstood reasons of this compile error.
Because of explicit of explicit operator bool
, clang++ rejects implicit boolean conversion return stream;
. So we should write return bool(stream);
instead of return stream;
I'll rebase this soon. Thanks for your awesome review comment :)
:+1:
Because of explicit of explicit operator bool, clang++ rejects implicit boolean conversion return stream;. So we should write return bool(stream); instead of return stream;
I see. Thanks for the description!
Merged at a479327c4b730430f5a5bc3bc7e8cec0724b86f9
(U16TrivialInputStream::operator bool): Replace with istream::good call (U16TrivialInputStream::operator!): Replace with istream::good calloperator bool
is libstdc++ extension. So libc++ doesn't have this feature.edit: Changed issue title to "Convert stream to boolean explicitly" See comment