From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-09-30 20:36:39


> >> I'm not keen on the use of operator<< to add the data to the exceptions.
> >
> > I do share your concern, but consider that whatever we use for boost
> > exception should support easy composition, because it needs to work
> > when used in a throw expression directly:
> >
> > throw my_error() <<
> > error_info<tag_errno>(errno) <<
> > error_info<tag_name>(name);
> >
> > Instead of << we could use .add:
> >
> > throw my_error().
> > add(error_info<tag_errno>(errno)).
> > add(error_info<tag_name>(name));
> >
> > This isn't bad, but in my opinion the << syntax is better despite my
> > strong dislike for operator overloading.
>
> Maybe a more or less obvious choice will do
>
> throw my_error() = error_info<tag>(whatever),
> error_info<another_tag>(something_else) // ...

I don't know, I'd rather use .add(), to be honest.

Also, in an off-list discussion, Peter Dimov pointed out that instead
of layering .add calls directly in the throw expression, we could
write:

my_error tmp;
tmp.add(error_info<tag_errno>(errno));
tmp.add(error_info<tag_name>(name));
throw tmp;

I'm not strongly opposed to that either.

Anyway, I think that operator<< is a good compromise, but if others
feel strongly against it I'll happily change it to .add().

Emil Dotchevski