|
Boost : |
From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-09-30 20:38:26
Tobias Schwinger wrote:
> Emil Dotchevski wrote:
>>> 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) // ...
>
Forgot to say: See Boost.Assign.
Making 'add' a function template might be another alternative:
throw my_error()
.add<tag::errno>(errno)
.add<tag::name>(name)
// ...
Regards,
Tobias Schwinger
- Review Manager -
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk