
I see different problems here. One is the hackish and completely unintuitive way << works: it does not create a temporary (we can't have more than one throw_ temp) and actually modifies its left argument. But that's a style issue.
I admit my current implementation is a bit hackish, not only that operator<< modifies its argument but in fact that argument is a const &. Obviously I implemented operator<< this way to avoid creating temps. But I should at least change the documentation to specify that operator<< has no effects and returns its argument by value.
int what_on_earth(earth &e) { // ... boost::throw_<something_bad_happened>() << e; // Does the compiler realize this is unreachable, or will it emit a missing return value warning/error? }
Ah yes, you're right it could be confused. Well, using failed<> doesn't have this problem. But I do want to come up with a better name for it! --Emil