On Tue, Jan 3, 2017 at 4:55 PM, Christof Donat
Hi,
Am 03.01.2017 16:08, schrieb Olaf van der Spek:
How about this one?
throw std::runtime_error("Error "s << 47);
Uh. How does that work with
std::cout << "Error "s << 47;
Will that be
(std::cout << "Error "s) << 47;
or
std::cout << ("Error "s << 47);
We've got rules for that.. http://en.cppreference.com/w/cpp/language/operator_precedence
I know, but you came up with C++ beginners. They already often get confused with streams and bit shifts, mostly when they come to C++ from C. Now we additionally mix expressions, where we can use manipulators with those, where we can't. That will probably make things worse not only for C++ beginners.
Maybe, maybe not. Overloading yet another operator for a similar (but not equal) purpose is problematic too.
I think << is quite elegant.
I feel very uneasy with it and I think I have presented quite some reasoning why.
You have, but I don't think we have a significantly better alternative.
Also I don't seem to be the only one in this discussion. At least that should count as a strong indicator, that you need much better reasons to back your proposal.
-- Olaf