|
Boost : |
Subject: Re: [boost] [TypeTraits] Are any of the new C++2011 traits implementable using SFINAE expressions?
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2011-04-19 13:19:40
On Apr 19, 2011, at 1:03 PM, John Maddock wrote:
> I'm quite sure the answer to this is no.... but are there any new language features in C++2011 that would allow the implementation of any of the following traits within the language? Thanks in advance, John.
>
> template <class T> struct is_trivial
> template <class T> struct is_trivially_copyable
> template <class T> struct is_standard_layout
> template <class T> struct is_literal_type
> template <class T, class... Args> struct is_constructible;
> template <class T> struct is_default_constructible;
> template <class T> struct is_copy_constructible;
> template <class T> struct is_move_constructible;
> template <class T, class U> struct is_assignable;
> template <class T> struct is_copy_assignable;
> template <class T> struct is_move_assignable;
> template <class T> struct is_destructible;
> template <class T, class... Args> struct is_trivially_constructible;
> template <class T> struct is_trivially_default_constructible;
> template <class T> struct is_trivially_copy_constructible;
> template <class T> struct is_trivially_move_constructible;
> template <class T, class U> struct is_trivially_assignable;
> template <class T> struct is_trivially_copy_assignable;
> template <class T> struct is_trivially_move_assignable;
> template <class T> struct is_trivially_destructible;
> template <class T, class... Args> struct is_nothrow_constructible;
> template <class T> struct is_nothrow_default_constructible;
> template <class T> struct is_nothrow_copy_constructible;
> template <class T> struct is_nothrow_move_constructible;
> template <class T, class U> struct is_nothrow_assignable;
> template <class T> struct is_nothrow_copy_assignable;
> template <class T> struct is_nothrow_move_assignable;
> template <class T> struct is_nothrow_destructible;
> template <class T> struct underlying_type;
I believe the answer is yes, but I don't have details because I don't yet have a fully conforming C++11 compiler to check against. A key change is CWG 1170:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1170
which changes SFINAE to take access checking into account. libc++ (http://libcxx.llvm.org/) has an attempt at is_constructible, from which many of the other traits are derived.
That being said, I'm very much looking forward to dumping libc++'s implementation of is_constructible in favor of a compiler intrinsic. :-)
Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk