Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-11-15 04:50:06


"Emil Dotchevski" <emildotchevski_at_[hidden]> writes:

> David Abrahams wrote:
>>
>> void tag_exception(boost::exception& x)
>> {
>> // do something to x
>> }
>>
>> void read_file()
>> {
>> boost::adorn_exception e( boost::bind( tag_exception, _1 ) );
>> ...
>> }
>
> Could you provide more detail on the "do something to x" part?

Whatever you'd do in the catch block with the current design, you
could do here.

> It seems to me that it would require something similar to the
> boost::exception::pimpl class, in that it must be able to store
> arbitrary values, but unlike boost::exception::pimpl it would have
> to keep some kind of proxy for each stored object, to be evaluated
> later if something throws.
>
> Wouldn't that amount to executing a lot of code and using a lot of
> storage, even if nothing throws?

Sorry, I don't see it. Maybe I'm just blind.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk