Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-10-06 07:45:04


Peter Dimov wrote:
> Tobias Schwinger wrote:
>
>> This approach provides better integration. But we're back in
>> boilerplate land (as you showed earlier in this thread).
>
> Boilerplate compared to what? You have to keep in mind where we're coming
> from:

<snip code: good old exception class>

> Switching to boost::exception actually removes most of the boilerplate code
> (at the expense of some memory allocations).

Actually I was comparing

     typedef boost::custom_exception<
         base,tag_a,tag_b /*...*/> my_exception;

and

     class my_exception : base
     {
        public:
          my_exception(a_t const& a, b_t const& b /*...*/)
          {
             (*this) << boost::error_info<tag_a>(a)
                 << boost::error_info<tag_b>(b)
             // ...
          }
     };

.

Of course, both variants have the potential to remove quite a lot of
boilerplate from traditional exception code.

> The dynamic allocation problem
> can likely be addressed by adding an allocator argument to boost::exception.

Yes, but adding allocator support shouldn't be substitute for
considering a more economic data structure (e.g. a single-linked list),
IMO.

Peter, is there any chance for you to find the time to write a full review?

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