|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-11-14 20:41:41
Matthew Herrmann <matthew.herrmann_at_[hidden]> writes:
> I think Mr Abrahams is referring to an idea similar to this: (please
> ignore the class name, it is a placeholder only)
>
> void read_file()
> {
> boost::exception_info e(..., filename, current_pos, is_connected);
> ...
> e.success();
> return;
> }
>
> e.success() sets a flag to true, which prevents the generation of error
> information when the object is destroyed.
No, that's not quite what I meant.
void tag_exception(boost::exception& x)
{
// do something to x
}
void read_file()
{
boost::adorn_exception e( boost::bind( tag_exception, _1 ) );
...
}
> To remove the e.success(), you'd need to detect whether the stack
> was being unwound due to an exception or due to a natural
> return. This is where language support (or compiler-dependent
> tricks) would be required.
We already have that facility: std::uncaught_exception().
-- 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