Subject: Re: [boost] Updated boost::base_from_member for C++2011
From: Daryle Walker (darylew_at_[hidden])
Date: 2012-02-18 12:56:14
> Date: Sat, 18 Feb 2012 12:04:09 +0900
> From: mimomorin_at_[hidden]
> Daryle Walker wrote:
> > I did it in (https://svn.boost.org/trac/boost/changeset/77046),
> > so check if it works for you now.
> Both r77046 and the version with SFINEAE to noexcept work well
> with clang-3.0 and gcc-4.6.
> > Of course, if you or someone else here has a better construction,
> > let me know and I'll try it instead.
> > (It still has to work for me on GCC-4.6, though.)
> Can NothrowConstructible be simply determined by
> rather than
> BOOST_NOEXCEPT_EXPR(::new ((void*) 0) MemberType(static_cast<T&&>(x)...))
That's the obvious way done by everyone at first, even me. I also saw it in the GCC LibStdC++v3 source for std::is_nothrow_default_constructible. However, every operation required for a noexcept expression is considered, including any destructor calls for temporary objects. That's why there's a "declval," after all. We need to call a constructor without a corresponding destructor, and the placement-new syntax (in a no-throw version) does that. The variant used is one of the few that's illegal to override.