on Sat Oct 04 2008, JoshuaMaurice-AT-gmail.com wrote:
> And I really, really like exceptions and RAII. Damn. Disclaimer: This
> doesn't kill all of RAII, but it kills some of it. It effectively
> forces two phase construction for most classes if you want efficient
> code on all platforms, and that makes me very sad.
And how, exactly, is two-phase construction going to save you cycles?
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Are throwing default constructors bad style, and if so, why?
Can a constexpr function throw an exception?!
Bo Persson ha scritto:
> I see that in N2798, the bitset::test function is now
>
> constexpr bool test(size_t pos) const;
>
> but is still required to throw an out_of_range exception for an
> invalid pos parameter.
>
>>From what I understand, section 7.1.5 requires the function body of a
> constexpr function to be
>
> { return expression; }
>
> where the expression is supposed to be a "potential constant
> expression (5.19)". However 5.19 specifically lists a throw expression
> as *not* allowed.
>
> How do we solve this?
>
See LWG issue #907 about this:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#907
Ganesh
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]