|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-11-21 08:46:06
----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, November 20, 2002 8:44 PM
Subject: [boost] Re: Do we need a boost_exception class or idiom?
> "David Abrahams" <dave_at_[hidden]> wrote in message
> news:u1y5fkj50.fsf_at_boost-consulting.com...
> [snip]
> > This seems like a very bad solution. It requires solving the
> > forwarding constructor problem, for one thing. boost::throw_exception
> > doesn't have that problem.
>
> I don't know about boost::throw_exception, but a nonmenber should be
> generally preferred to a member. Thus, I find the solution based on member
> raise poor. An equivalent free function can be written:
>
> template <class T>
> void raise(const T& exc)
> {
> #ifdef ...
> throw exc;
> #endif
> }
>
Your are absolutely right, and boost::throw_exception is precisely a
non-member raise.
So I take back my strong encouragement (...each time I strongly say
something it turns out to be wrong. :-o )
The actual point was that code shouldn't just use a throw expression
directly.
> Andrei
Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk