Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-07 09:49:09


Alex Besogonov <cyberax_at_[hidden]> writes:

> It turns out that this trick is explicitly permitted by the Standard (as
> it was pointed in this post:
> http://rsdn.ru/Forum/Message.aspx?mid=1420469&only=1).

For what it's worth, that trick is not very portable in practice, at
least not to many of the older compilers that Boost.Bind is trying to
support. I suggest that instead, you do something like this:

void ExceptionFilter(boost::function0<> f)
{
     try {
         f();
     } catch(Exception1 const& e) {
         //Blah-blah 1
     } catch(Exception2 const& e) {
         //Blah-blah 2
     } catch(Exception3 const& e) {
         //Blah-blah 3
     } catch(Exception4 const& e) {
         //Blah-blah 4
     } catch(Exception5 const& e) {
         throw; //Just rethrow
     } catch(...) {
         //Something other
     }
}

-- 
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