head	1.8;
access;
symbols
	RELENG_9_1_0_RELEASE:1.3.2.2
	RELENG_9_1:1.3.2.2.0.2
	RELENG_9_1_BP:1.3.2.2
	RELENG_9:1.3.0.2;
locks; strict;
comment	@# @;


1.8
date	2013.07.11.00.34.38;	author svnexp;	state Exp;
branches;
next	1.7;

1.7
date	2013.04.28.00.41.54;	author svnexp;	state Exp;
branches;
next	1.6;

1.6
date	2013.02.08.05.09.54;	author svnexp;	state Exp;
branches;
next	1.5;

1.5
date	2012.11.17.03.36.33;	author svnexp;	state Exp;
branches;
next	1.4;

1.4
date	2012.10.22.18.25.04;	author dim;	state Exp;
branches;
next	1.3;

1.3
date	2012.05.03.17.44.07;	author theraven;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2012.03.14.00.09.36;	author theraven;	state Exp;
branches;
next	1.1;

1.1
date	2011.11.25.20.59.04;	author theraven;	state Exp;
branches;
next	;

1.3.2.1
date	2012.05.22.18.30.14;	author theraven;	state dead;
branches;
next	1.3.2.2;

1.3.2.2
date	2012.05.22.18.30.14;	author theraven;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2012.11.21.18.41.41;	author svnexp;	state Exp;
branches;
next	1.3.2.4;

1.3.2.4
date	2012.11.29.21.29.14;	author svnexp;	state Exp;
branches;
next	1.3.2.5;

1.3.2.5
date	2013.05.11.17.01.44;	author svnexp;	state Exp;
branches;
next	1.3.2.6;

1.3.2.6
date	2013.07.11.22.01.44;	author svnexp;	state Exp;
branches;
next	1.3.2.7;

1.3.2.7
date	2014.01.04.18.01.50;	author svnexp;	state Exp;
branches;
next	1.3.2.8;

1.3.2.8
date	2014.03.05.20.01.45;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.8
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/253159
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@// -*- C++ -*-
//===------------------------ type_traits ---------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_TYPE_TRAITS
#define _LIBCPP_TYPE_TRAITS

/*
    type_traits synopsis

namespace std
{

    // helper class:
    template <class T, T v> struct integral_constant;
    typedef integral_constant<bool, true>  true_type;
    typedef integral_constant<bool, false> false_type;

    // helper traits
    template <bool, class T = void> struct enable_if;
    template <bool, class T, class F> struct conditional;

    // Primary classification traits:
    template <class T> struct is_void;
    template <class T> struct is_integral;
    template <class T> struct is_floating_point;
    template <class T> struct is_array;
    template <class T> struct is_pointer;
    template <class T> struct is_lvalue_reference;
    template <class T> struct is_rvalue_reference;
    template <class T> struct is_member_object_pointer;
    template <class T> struct is_member_function_pointer;
    template <class T> struct is_enum;
    template <class T> struct is_union;
    template <class T> struct is_class;
    template <class T> struct is_function;

    // Secondary classification traits:
    template <class T> struct is_reference;
    template <class T> struct is_arithmetic;
    template <class T> struct is_fundamental;
    template <class T> struct is_member_pointer;
    template <class T> struct is_scalar;
    template <class T> struct is_object;
    template <class T> struct is_compound;

    // Const-volatile properties and transformations:
    template <class T> struct is_const;
    template <class T> struct is_volatile;
    template <class T> struct remove_const;
    template <class T> struct remove_volatile;
    template <class T> struct remove_cv;
    template <class T> struct add_const;
    template <class T> struct add_volatile;
    template <class T> struct add_cv;

    // Reference transformations:
    template <class T> struct remove_reference;
    template <class T> struct add_lvalue_reference;
    template <class T> struct add_rvalue_reference;

    // Pointer transformations:
    template <class T> struct remove_pointer;
    template <class T> struct add_pointer;

    // Integral properties:
    template <class T> struct is_signed;
    template <class T> struct is_unsigned;
    template <class T> struct make_signed;
    template <class T> struct make_unsigned;

    // Array properties and transformations:
    template <class T> struct rank;
    template <class T, unsigned I = 0> struct extent;
    template <class T> struct remove_extent;
    template <class T> struct remove_all_extents;

    // Member introspection:
    template <class T> struct is_pod;
    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> struct is_empty;
    template <class T> struct is_polymorphic;
    template <class T> struct is_abstract;

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

    // Relationships between types:
    template <class T, class U> struct is_same;
    template <class Base, class Derived> struct is_base_of;
    template <class From, class To> struct is_convertible;

    // Alignment properties and transformations:
    template <class T> struct alignment_of;
    template <size_t Len, size_t Align = most_stringent_alignment_requirement>
        struct aligned_storage;
    template <size_t Len, class... Types> struct aligned_union;

    template <class T> struct decay;
    template <class... T> struct common_type;
    template <class T> struct underlying_type;
    template <class> class result_of; // undefined
    template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>;

    // const-volatile modifications:
    template <class T>
      using remove_const_t    = typename remove_const<T>::type;  // C++14
    template <class T>
      using remove_volatile_t = typename remove_volatile<T>::type;  // C++14
    template <class T>
      using remove_cv_t       = typename remove_cv<T>::type;  // C++14
    template <class T>
      using add_const_t       = typename add_const<T>::type;  // C++14
    template <class T>
      using add_volatile_t    = typename add_volatile<T>::type;  // C++14
    template <class T>
      using add_cv_t          = typename add_cv<T>::type;  // C++14
  
    // reference modifications:
    template <class T>
      using remove_reference_t     = typename remove_reference<T>::type;  // C++14
    template <class T>
      using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;  // C++14
    template <class T>
      using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;  // C++14
  
    // sign modifications:
    template <class T>
      using make_signed_t   = typename make_signed<T>::type;  // C++14
    template <class T>
      using make_unsigned_t = typename make_unsigned<T>::type;  // C++14
  
    // array modifications:
    template <class T>
      using remove_extent_t      = typename remove_extent<T>::type;  // C++14
    template <class T>
      using remove_all_extents_t = typename remove_all_extents<T>::type;  // C++14

    // pointer modifications:
    template <class T>
      using remove_pointer_t = typename remove_pointer<T>::type;  // C++14
    template <class T>
      using add_pointer_t    = typename add_pointer<T>::type;  // C++14

    // other transformations:
    template <size_t Len, std::size_t Align=default-alignment>
      using aligned_storage_t = typename aligned_storage<Len,Align>::type;  // C++14
    template <std::size_t Len, class... Types>
      using aligned_union_t   = typename aligned_union<Len,Types...>::type;  // C++14
    template <class T>
      using decay_t           = typename decay<T>::type;  // C++14
    template <bool b, class T=void>
      using enable_if_t       = typename enable_if<b,T>::type;  // C++14
    template <bool b, class T, class F>
      using conditional_t     = typename conditional<b,T,F>::type;  // C++14
    template <class... T>
      using common_type_t     = typename common_type<T...>::type;  // C++14
    template <class T>
      using underlying_type_t = typename underlying_type<T>::type;  // C++14
    template <class F, class... ArgTypes>
      using result_of_t       = typename result_of<F(ArgTypes...)>::type;  // C++14

}  // std

*/
#include <__config>
#include <cstddef>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

template <bool _Bp, class _If, class _Then>
    struct _LIBCPP_TYPE_VIS conditional {typedef _If type;};
template <class _If, class _Then>
    struct _LIBCPP_TYPE_VIS conditional<false, _If, _Then> {typedef _Then type;};

#if _LIBCPP_STD_VER > 11
template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
#endif

template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS enable_if {};
template <class _Tp> struct _LIBCPP_TYPE_VIS enable_if<true, _Tp> {typedef _Tp type;};

#if _LIBCPP_STD_VER > 11
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
#endif


struct __two {char __lx[2];};

// helper class:

template <class _Tp, _Tp __v>
struct _LIBCPP_TYPE_VIS integral_constant
{
    static _LIBCPP_CONSTEXPR const _Tp      value = __v;
    typedef _Tp               value_type;
    typedef integral_constant type;
    _LIBCPP_INLINE_VISIBILITY
        _LIBCPP_CONSTEXPR operator value_type() const {return value;}
};

template <class _Tp, _Tp __v>
_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;

typedef integral_constant<bool, true>  true_type;
typedef integral_constant<bool, false> false_type;

// is_const

template <class _Tp> struct _LIBCPP_TYPE_VIS is_const            : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_const<_Tp const> : public true_type {};

// is_volatile

template <class _Tp> struct _LIBCPP_TYPE_VIS is_volatile               : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_volatile<_Tp volatile> : public true_type {};

// remove_const

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_const            {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_const<const _Tp> {typedef _Tp type;};
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
#endif

// remove_volatile

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_volatile               {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
#endif

// remove_cv

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_cv
{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
#endif

// is_void

template <class _Tp> struct __is_void       : public false_type {};
template <>          struct __is_void<void> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_void
    : public __is_void<typename remove_cv<_Tp>::type> {};

// __is_nullptr_t

template <class _Tp> struct ____is_nullptr_t       : public false_type {};
template <>          struct ____is_nullptr_t<nullptr_t> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS __is_nullptr_t
    : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};

// is_integral

template <class _Tp> struct __is_integral                     : public false_type {};
template <>          struct __is_integral<bool>               : public true_type {};
template <>          struct __is_integral<char>               : public true_type {};
template <>          struct __is_integral<signed char>        : public true_type {};
template <>          struct __is_integral<unsigned char>      : public true_type {};
template <>          struct __is_integral<wchar_t>            : public true_type {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>          struct __is_integral<char16_t>           : public true_type {};
template <>          struct __is_integral<char32_t>           : public true_type {};
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
template <>          struct __is_integral<short>              : public true_type {};
template <>          struct __is_integral<unsigned short>     : public true_type {};
template <>          struct __is_integral<int>                : public true_type {};
template <>          struct __is_integral<unsigned int>       : public true_type {};
template <>          struct __is_integral<long>               : public true_type {};
template <>          struct __is_integral<unsigned long>      : public true_type {};
template <>          struct __is_integral<long long>          : public true_type {};
template <>          struct __is_integral<unsigned long long> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_integral
    : public __is_integral<typename remove_cv<_Tp>::type> {};

// is_floating_point

template <class _Tp> struct __is_floating_point              : public false_type {};
template <>          struct __is_floating_point<float>       : public true_type {};
template <>          struct __is_floating_point<double>      : public true_type {};
template <>          struct __is_floating_point<long double> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_floating_point
    : public __is_floating_point<typename remove_cv<_Tp>::type> {};

// is_array

template <class _Tp> struct _LIBCPP_TYPE_VIS is_array
    : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_array<_Tp[]>
    : public true_type {};
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS is_array<_Tp[_Np]>
    : public true_type {};

// is_pointer

template <class _Tp> struct __is_pointer       : public false_type {};
template <class _Tp> struct __is_pointer<_Tp*> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_pointer
    : public __is_pointer<typename remove_cv<_Tp>::type> {};

// is_reference

template <class _Tp> struct _LIBCPP_TYPE_VIS is_lvalue_reference       : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_lvalue_reference<_Tp&> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_rvalue_reference        : public false_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_TYPE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
#endif

template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference        : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference<_Tp&>  : public true_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference<_Tp&&> : public true_type {};
#endif

#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_TYPE_TRAITS
#endif

// is_union

#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS is_union
    : public integral_constant<bool, __is_union(_Tp)> {};

#else

template <class _Tp> struct __libcpp_union : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_union
    : public __libcpp_union<typename remove_cv<_Tp>::type> {};

#endif

// is_class

#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS is_class
    : public integral_constant<bool, __is_class(_Tp)> {};

#else

namespace __is_class_imp
{
template <class _Tp> char  __test(int _Tp::*);
template <class _Tp> __two __test(...);
}

template <class _Tp> struct _LIBCPP_TYPE_VIS is_class
    : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {};

#endif

// is_same

template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS is_same           : public false_type {};
template <class _Tp>            struct _LIBCPP_TYPE_VIS is_same<_Tp, _Tp> : public true_type {};

// is_function

namespace __is_function_imp
{
template <class _Tp> char  __test(_Tp*);
template <class _Tp> __two __test(...);
template <class _Tp> _Tp&  __source();
}

template <class _Tp, bool = is_class<_Tp>::value ||
                            is_union<_Tp>::value ||
                            is_void<_Tp>::value  ||
                            is_reference<_Tp>::value ||
                            is_same<_Tp, nullptr_t>::value >
struct __is_function
    : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1>
    {};
template <class _Tp> struct __is_function<_Tp, true> : public false_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_function
    : public __is_function<_Tp> {};

// is_member_function_pointer

template <class _Tp> struct            __is_member_function_pointer             : public false_type {};
template <class _Tp, class _Up> struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_function_pointer
    : public __is_member_function_pointer<typename remove_cv<_Tp>::type> {};

// is_member_pointer

template <class _Tp>            struct __is_member_pointer             : public false_type {};
template <class _Tp, class _Up> struct __is_member_pointer<_Tp _Up::*> : public true_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_pointer
    : public __is_member_pointer<typename remove_cv<_Tp>::type> {};

// is_member_object_pointer

template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_object_pointer
    : public integral_constant<bool, is_member_pointer<_Tp>::value &&
                                    !is_member_function_pointer<_Tp>::value> {};

// is_enum

#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS is_enum
    : public integral_constant<bool, __is_enum(_Tp)> {};

#else

template <class _Tp> struct _LIBCPP_TYPE_VIS is_enum
    : public integral_constant<bool, !is_void<_Tp>::value             &&
                                     !is_integral<_Tp>::value         &&
                                     !is_floating_point<_Tp>::value   &&
                                     !is_array<_Tp>::value            &&
                                     !is_pointer<_Tp>::value          &&
                                     !is_reference<_Tp>::value        &&
                                     !is_member_pointer<_Tp>::value   &&
                                     !is_union<_Tp>::value            &&
                                     !is_class<_Tp>::value            &&
                                     !is_function<_Tp>::value         > {};

#endif

// is_arithmetic

template <class _Tp> struct _LIBCPP_TYPE_VIS is_arithmetic
    : public integral_constant<bool, is_integral<_Tp>::value      ||
                                     is_floating_point<_Tp>::value> {};

// is_fundamental

template <class _Tp> struct _LIBCPP_TYPE_VIS is_fundamental
    : public integral_constant<bool, is_void<_Tp>::value        ||
                                     __is_nullptr_t<_Tp>::value ||
                                     is_arithmetic<_Tp>::value> {};

// is_scalar

template <class _Tp> struct _LIBCPP_TYPE_VIS is_scalar
    : public integral_constant<bool, is_arithmetic<_Tp>::value     ||
                                     is_member_pointer<_Tp>::value ||
                                     is_pointer<_Tp>::value        ||
                                     __is_nullptr_t<_Tp>::value    ||
                                     is_enum<_Tp>::value           > {};

template <> struct _LIBCPP_TYPE_VIS is_scalar<nullptr_t> : public true_type {};

// is_object

template <class _Tp> struct _LIBCPP_TYPE_VIS is_object
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_array<_Tp>::value  ||
                                     is_union<_Tp>::value  ||
                                     is_class<_Tp>::value  > {};

// is_compound

template <class _Tp> struct _LIBCPP_TYPE_VIS is_compound
    : public integral_constant<bool, !is_fundamental<_Tp>::value> {};

// add_const

template <class _Tp, bool = is_reference<_Tp>::value ||
                            is_function<_Tp>::value  ||
                            is_const<_Tp>::value     >
struct __add_const             {typedef _Tp type;};

template <class _Tp>
struct __add_const<_Tp, false> {typedef const _Tp type;};

template <class _Tp> struct _LIBCPP_TYPE_VIS add_const
    {typedef typename __add_const<_Tp>::type type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
#endif

// add_volatile

template <class _Tp, bool = is_reference<_Tp>::value ||
                            is_function<_Tp>::value  ||
                            is_volatile<_Tp>::value  >
struct __add_volatile             {typedef _Tp type;};

template <class _Tp>
struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};

template <class _Tp> struct _LIBCPP_TYPE_VIS add_volatile
    {typedef typename __add_volatile<_Tp>::type type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
#endif

// add_cv

template <class _Tp> struct _LIBCPP_TYPE_VIS add_cv
    {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
#endif

// remove_reference

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference        {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference<_Tp&>  {typedef _Tp type;};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference<_Tp&&> {typedef _Tp type;};
#endif

#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
#endif

// add_lvalue_reference

template <class _Tp> struct _LIBCPP_TYPE_VIS add_lvalue_reference                      {typedef _Tp& type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<const volatile void> {typedef const volatile void type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
#endif

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp> struct _LIBCPP_TYPE_VIS  add_rvalue_reference                     {typedef _Tp&& type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<const volatile void> {typedef const volatile void type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
#endif

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
typename add_rvalue_reference<_Tp>::type
declval() _NOEXCEPT;

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
typename add_lvalue_reference<_Tp>::type
declval();

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

struct __any
{
    __any(...);
};

// remove_pointer

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer                      {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp*>                {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* const>          {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* volatile>       {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* const volatile> {typedef _Tp type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
#endif

// add_pointer

template <class _Tp> struct _LIBCPP_TYPE_VIS add_pointer
    {typedef typename remove_reference<_Tp>::type* type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
#endif

// is_signed

template <class _Tp, bool = is_integral<_Tp>::value>
struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};

template <class _Tp>
struct ___is_signed<_Tp, false> : public true_type {};  // floating point

template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_signed : public ___is_signed<_Tp> {};

template <class _Tp> struct __is_signed<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_signed : public __is_signed<_Tp> {};

// is_unsigned

template <class _Tp, bool = is_integral<_Tp>::value>
struct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};

template <class _Tp>
struct ___is_unsigned<_Tp, false> : public false_type {};  // floating point

template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_unsigned : public ___is_unsigned<_Tp> {};

template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_unsigned : public __is_unsigned<_Tp> {};

// rank

template <class _Tp> struct _LIBCPP_TYPE_VIS rank
    : public integral_constant<size_t, 0> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS rank<_Tp[]>
    : public integral_constant<size_t, rank<_Tp>::value + 1> {};
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS rank<_Tp[_Np]>
    : public integral_constant<size_t, rank<_Tp>::value + 1> {};

// extent

template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS extent
    : public integral_constant<size_t, 0> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS extent<_Tp[], 0>
    : public integral_constant<size_t, 0> {};
template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS extent<_Tp[], _Ip>
    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS extent<_Tp[_Np], 0>
    : public integral_constant<size_t, _Np> {};
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS extent<_Tp[_Np], _Ip>
    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};

// remove_extent

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_extent
    {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_extent<_Tp[]>
    {typedef _Tp type;};
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS remove_extent<_Tp[_Np]>
    {typedef _Tp type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
#endif

// remove_all_extents

template <class _Tp> struct _LIBCPP_TYPE_VIS remove_all_extents
    {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_all_extents<_Tp[]>
    {typedef typename remove_all_extents<_Tp>::type type;};
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS remove_all_extents<_Tp[_Np]>
    {typedef typename remove_all_extents<_Tp>::type type;};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
#endif

// is_abstract

namespace __is_abstract_imp
{
template <class _Tp> char  __test(_Tp (*)[1]);
template <class _Tp> __two __test(...);
}

template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};

template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_abstract : public __libcpp_abstract<_Tp> {};

// is_base_of

#ifdef _LIBCP_HAS_IS_BASE_OF

template <class _Bp, class _Dp>
struct _LIBCPP_TYPE_VIS is_base_of
    : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};

#else  // __has_feature(is_base_of)

namespace __is_base_of_imp
{
template <class _Tp>
struct _Dst
{
    _Dst(const volatile _Tp &);
};
template <class _Tp>
struct _Src
{
    operator const volatile _Tp &();
    template <class _Up> operator const _Dst<_Up> &();
};
template <size_t> struct __one { typedef char type; };
template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
template <class _Bp, class _Dp> __two __test(...);
}

template <class _Bp, class _Dp>
struct _LIBCPP_TYPE_VIS is_base_of
    : public integral_constant<bool, is_class<_Bp>::value &&
                                     sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};

#endif  // __has_feature(is_base_of)

// is_convertible

#if __has_feature(is_convertible_to)

template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS is_convertible
    : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
                                     !is_abstract<_T2>::value> {};

#else  // __has_feature(is_convertible_to)

namespace __is_convertible_imp
{
template <class _Tp> char  __test(_Tp);
template <class _Tp> __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> _Tp&& __source();
#else
template <class _Tp> typename remove_reference<_Tp>::type& __source();
#endif

template <class _Tp, bool _IsArray =    is_array<_Tp>::value,
                     bool _IsFunction = is_function<_Tp>::value,
                     bool _IsVoid =     is_void<_Tp>::value>
                     struct __is_array_function_or_void                          {enum {value = 0};};
template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
}

template <class _Tp,
    unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
struct __is_convertible_check
{
    static const size_t __v = 0;
};

template <class _Tp>
struct __is_convertible_check<_Tp, 0>
{
    static const size_t __v = sizeof(_Tp);
};

template <class _T1, class _T2,
    unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
    unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
struct __is_convertible
    : public integral_constant<bool,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
        sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
#else
        sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
         && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
              && (!is_const<typename remove_reference<_T2>::type>::value
                  || is_volatile<typename remove_reference<_T2>::type>::value)
                  && (is_same<typename remove_cv<_T1>::type,
                              typename remove_cv<typename remove_reference<_T2>::type>::type>::value
                      || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
#endif
    >
{};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};

template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {};
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0>                : public false_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1>            struct __is_convertible<_T1, _T1&&, 2, 0>               : public true_type {};
#endif
template <class _T1>            struct __is_convertible<_T1, _T1&, 2, 0>               : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*, 2, 0>               : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*const, 2, 0>          : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*volatile, 2, 0>       : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};

template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS is_convertible
    : public __is_convertible<_T1, _T2>
{
    static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
    static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
};

#endif  // __has_feature(is_convertible_to)

// is_empty

#if __has_feature(is_empty)

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_empty
    : public integral_constant<bool, __is_empty(_Tp)> {};

#else  // __has_feature(is_empty)

template <class _Tp>
struct __is_empty1
    : public _Tp
{
    double __lx;
};

struct __is_empty2
{
    double __lx;
};

template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {};

template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_empty : public __libcpp_empty<_Tp> {};

#endif  // __has_feature(is_empty)

// is_polymorphic

#if __has_feature(is_polymorphic)

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_polymorphic
    : public integral_constant<bool, __is_polymorphic(_Tp)> {};

#else

template<typename _Tp> char &__is_polymorphic_impl(
    typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
                       int>::type);
template<typename _Tp> __two &__is_polymorphic_impl(...);

template <class _Tp> struct _LIBCPP_TYPE_VIS is_polymorphic
    : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};

#endif // __has_feature(is_polymorphic)

// has_virtual_destructor

#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS has_virtual_destructor
    : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct _LIBCPP_TYPE_VIS has_virtual_destructor
    : public false_type {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// alignment_of

template <class _Tp> struct _LIBCPP_TYPE_VIS alignment_of
    : public integral_constant<size_t, __alignof__(_Tp)> {};

// aligned_storage

template <class _Hp, class _Tp>
struct __type_list
{
    typedef _Hp _Head;
    typedef _Tp _Tail;
};

struct __nat
{
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
    __nat() = delete;
    __nat(const __nat&) = delete;
    __nat& operator=(const __nat&) = delete;
    ~__nat() = delete;
#endif
};

template <class _Tp>
struct __align_type
{
    static const size_t value = alignment_of<_Tp>::value;
    typedef _Tp type;
};

struct __struct_double {long double __lx;};
struct __struct_double4 {double __lx[4];};

typedef
    __type_list<__align_type<unsigned char>,
    __type_list<__align_type<unsigned short>,
    __type_list<__align_type<unsigned int>,
    __type_list<__align_type<unsigned long>,
    __type_list<__align_type<unsigned long long>,
    __type_list<__align_type<double>,
    __type_list<__align_type<long double>,
    __type_list<__align_type<__struct_double>,
    __type_list<__align_type<__struct_double4>,
    __type_list<__align_type<int*>,
    __nat
    > > > > > > > > > > __all_types;

template <class _TL, size_t _Align> struct __find_pod;

template <class _Hp, size_t _Align>
struct __find_pod<__type_list<_Hp, __nat>, _Align>
{
    typedef typename conditional<
                             _Align == _Hp::value,
                             typename _Hp::type,
                             void
                         >::type type;
};

template <class _Hp, class _Tp, size_t _Align>
struct __find_pod<__type_list<_Hp, _Tp>, _Align>
{
    typedef typename conditional<
                             _Align == _Hp::value,
                             typename _Hp::type,
                             typename __find_pod<_Tp, _Align>::type
                         >::type type;
};

template <class _TL, size_t _Len> struct __find_max_align;

template <class _Hp, size_t _Len>
struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};

template <size_t _Len, size_t _A1, size_t _A2>
struct __select_align
{
private:
    static const size_t __min = _A2 < _A1 ? _A2 : _A1;
    static const size_t __max = _A1 < _A2 ? _A2 : _A1;
public:
    static const size_t value = _Len < __max ? __min : __max;
};

template <class _Hp, class _Tp, size_t _Len>
struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
    : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};

template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
struct _LIBCPP_TYPE_VIS aligned_storage
{
    typedef typename __find_pod<__all_types, _Align>::type _Aligner;
    static_assert(!is_void<_Aligner>::value, "");
    union type
    {
        _Aligner __align;
        unsigned char __data[_Len];
    };
};

#if _LIBCPP_STD_VER > 11
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
    using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
#endif

#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \
template <size_t _Len>\
struct _LIBCPP_TYPE_VIS aligned_storage<_Len, n>\
{\
    struct _ALIGNAS(n) type\
    {\
        unsigned char __lx[_Len];\
    };\
}

_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
#if !defined(_MSC_VER)
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
#endif // !_MSC_VER

#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION

#ifndef _LIBCPP_HAS_NO_VARIADICS

// aligned_union

template <size_t _I0, size_t ..._In>
struct __static_max;

template <size_t _I0>
struct __static_max<_I0>
{
    static const size_t value = _I0;
};

template <size_t _I0, size_t _I1, size_t ..._In>
struct __static_max<_I0, _I1, _In...>
{
    static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value :
                                             __static_max<_I1, _In...>::value;
};

template <size_t _Len, class _Type0, class ..._Types>
struct aligned_union
{
    static const size_t alignment_value = __static_max<__alignof__(_Type0),
                                                       __alignof__(_Types)...>::value;
    static const size_t __len = __static_max<_Len, sizeof(_Type0),
                                             sizeof(_Types)...>::value;
    typedef typename aligned_storage<__len, alignment_value>::type type;
};

#if _LIBCPP_STD_VER > 11
template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
#endif

#endif  // _LIBCPP_HAS_NO_VARIADICS

// __promote

template <class _A1, class _A2 = void, class _A3 = void,
          bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) &&
                 (is_arithmetic<_A2>::value || is_void<_A2>::value) &&
                 (is_arithmetic<_A3>::value || is_void<_A3>::value)>
class __promote {};

template <class _A1, class _A2, class _A3>
class __promote<_A1, _A2, _A3, true>
{
private:
    typedef typename __promote<_A1>::type __type1;
    typedef typename __promote<_A2>::type __type2;
    typedef typename __promote<_A3>::type __type3;
public:
    typedef decltype(__type1() + __type2() + __type3()) type;
};

template <class _A1, class _A2>
class __promote<_A1, _A2, void, true>
{
private:
    typedef typename __promote<_A1>::type __type1;
    typedef typename __promote<_A2>::type __type2;
public:
    typedef decltype(__type1() + __type2()) type;
};

template <class _A1>
class __promote<_A1, void, void, true>
{
public:
    typedef typename conditional<is_arithmetic<_A1>::value,
                     typename conditional<is_integral<_A1>::value, double, _A1>::type,
                     void
            >::type type;
};

#ifdef _LIBCPP_STORE_AS_OPTIMIZATION

// __transform

template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;};
template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char      type;};
template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short     type;};
template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int       type;};
template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;};

#endif  // _LIBCPP_STORE_AS_OPTIMIZATION

// make_signed / make_unsigned

typedef
    __type_list<signed char,
    __type_list<signed short,
    __type_list<signed int,
    __type_list<signed long,
    __type_list<signed long long,
    __nat
    > > > > > __signed_types;

typedef
    __type_list<unsigned char,
    __type_list<unsigned short,
    __type_list<unsigned int,
    __type_list<unsigned long,
    __type_list<unsigned long long,
    __nat
    > > > > > __unsigned_types;

template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;

template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
{
    typedef _Hp type;
};

template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
{
    typedef typename __find_first<_Tp, _Size>::type type;
};

template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
                             bool = is_volatile<typename remove_reference<_Tp>::type>::value>
struct __apply_cv
{
    typedef _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, false>
{
    typedef const _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, false, true>
{
    typedef volatile _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, true>
{
    typedef const volatile _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, false>
{
    typedef _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, false>
{
    typedef const _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, true>
{
    typedef volatile _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, true>
{
    typedef const volatile _Up& type;
};

template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_signed {};

template <class _Tp>
struct __make_signed<_Tp, true>
{
    typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
};

template <> struct __make_signed<bool,               true> {};
template <> struct __make_signed<  signed short,     true> {typedef short     type;};
template <> struct __make_signed<unsigned short,     true> {typedef short     type;};
template <> struct __make_signed<  signed int,       true> {typedef int       type;};
template <> struct __make_signed<unsigned int,       true> {typedef int       type;};
template <> struct __make_signed<  signed long,      true> {typedef long      type;};
template <> struct __make_signed<unsigned long,      true> {typedef long      type;};
template <> struct __make_signed<  signed long long, true> {typedef long long type;};
template <> struct __make_signed<unsigned long long, true> {typedef long long type;};

template <class _Tp>
struct _LIBCPP_TYPE_VIS make_signed
{
    typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type;
#endif

template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_unsigned {};

template <class _Tp>
struct __make_unsigned<_Tp, true>
{
    typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
};

template <> struct __make_unsigned<bool,               true> {};
template <> struct __make_unsigned<  signed short,     true> {typedef unsigned short     type;};
template <> struct __make_unsigned<unsigned short,     true> {typedef unsigned short     type;};
template <> struct __make_unsigned<  signed int,       true> {typedef unsigned int       type;};
template <> struct __make_unsigned<unsigned int,       true> {typedef unsigned int       type;};
template <> struct __make_unsigned<  signed long,      true> {typedef unsigned long      type;};
template <> struct __make_unsigned<unsigned long,      true> {typedef unsigned long      type;};
template <> struct __make_unsigned<  signed long long, true> {typedef unsigned long long type;};
template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};

template <class _Tp>
struct _LIBCPP_TYPE_VIS make_unsigned
{
    typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
#endif

#ifdef _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _Up = void, class V = void>
struct _LIBCPP_TYPE_VIS common_type
{
public:
    typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type;
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS common_type<_Tp, void, void>
{
public:
    typedef _Tp type;
};

template <class _Tp, class _Up>
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up, void>
{
private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    static _Tp&& __t();
    static _Up&& __u();
#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
    static _Tp __t();
    static _Up __u();
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
    typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
};

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class ..._Tp> struct common_type;

template <class _Tp>
struct _LIBCPP_TYPE_VIS common_type<_Tp>
{
    typedef _Tp type;
};

template <class _Tp, class _Up>
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up>
{
private:
    static _Tp&& __t();
    static _Up&& __u();
    static bool __f();
public:
    typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type;
};

template <class _Tp, class _Up, class ..._Vp>
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up, _Vp...>
{
    typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
};

#if _LIBCPP_STD_VER > 11
template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
#endif

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_assignable

template <class _Tp, class _Arg>
decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type()))
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_assignable_test(_Tp&&, _Arg&&);
#else
__is_assignable_test(_Tp, _Arg&);
#endif

template <class _Arg>
false_type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_assignable_test(__any, _Arg&&);
#else
__is_assignable_test(__any, _Arg&);
#endif

template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
struct __is_assignable_imp
    : public common_type
        <
            decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
        >::type {};

template <class _Tp, class _Arg>
struct __is_assignable_imp<_Tp, _Arg, true>
    : public false_type
{
};

template <class _Tp, class _Arg>
struct is_assignable
    : public __is_assignable_imp<_Tp, _Arg> {};

// is_copy_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_copy_assignable
    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
                     const typename add_lvalue_reference<_Tp>::type> {};

// is_move_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_move_assignable
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
                     const typename add_rvalue_reference<_Tp>::type> {};
#else
    : public is_copy_assignable<_Tp> {};
#endif

// is_destructible

template <class _Tp>
struct __destructible_test
{
    _Tp __t;
};

template <class _Tp>
decltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type()))
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_destructible_test(_Tp&&);
#else
__is_destructible_test(_Tp&);
#endif

false_type
__is_destructible_test(__any);

template <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value>
struct __destructible_imp
    : public common_type
        <
            decltype(__is_destructible_test(declval<_Tp>()))
        >::type {};

template <class _Tp>
struct __destructible_imp<_Tp, true>
    : public false_type {};

template <class _Tp>
struct is_destructible
    : public __destructible_imp<_Tp> {};

// move

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename remove_reference<_Tp>::type&&
move(_Tp&& __t) _NOEXCEPT
{
    typedef typename remove_reference<_Tp>::type _Up;
    return static_cast<_Up&&>(__t);
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&&
forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
{
    return static_cast<_Tp&&>(__t);
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&&
forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
{
    static_assert(!std::is_lvalue_reference<_Tp>::value,
                  "Can not forward an rvalue as an lvalue.");
    return static_cast<_Tp&&>(__t);
}

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
move(_Tp& __t)
{
    return __t;
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
move(const _Tp& __t)
{
    return __t;
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
{
    return __t;
}


template <class _Tp>
class __rv
{
    typedef typename remove_reference<_Tp>::type _Trr;
    _Trr& t_;
public:
    _LIBCPP_INLINE_VISIBILITY
    _Trr* operator->() {return &t_;}
    _LIBCPP_INLINE_VISIBILITY
    explicit __rv(_Trr& __t) : t_(__t) {}
};

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct _LIBCPP_TYPE_VIS decay
{
private:
    typedef typename remove_reference<_Tp>::type _Up;
public:
    typedef typename conditional
                     <
                         is_array<_Up>::value,
                         typename remove_extent<_Up>::type*,
                         typename conditional
                         <
                              is_function<_Up>::value,
                              typename add_pointer<_Up>::type,
                              typename remove_cv<_Up>::type
                         >::type
                     >::type type;
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using decay_t = typename decay<_Tp>::type;
#endif

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename decay<_Tp>::type
__decay_copy(_Tp&& __t)
{
    return _VSTD::forward<_Tp>(__t);
}

#else

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename decay<_Tp>::type
__decay_copy(const _Tp& __t)
{
    return _VSTD::forward<_Tp>(__t);
}

#endif

template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{
};

#ifndef _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

#if __has_feature(cxx_reference_qualified_functions)

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
{
    typedef _Class& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
{
    typedef _Class const& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
{
    typedef _Class volatile& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
{
    typedef _Class const volatile& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
{
    typedef _Class&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
{
    typedef _Class const&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
{
    typedef _Class volatile&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
{
    typedef _Class const volatile&& _ClassType;
    typedef _Rp _ReturnType;
};

#endif  // __has_feature(cxx_reference_qualified_functions)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _MP>
struct __member_pointer_traits
    : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
                    is_member_function_pointer<_MP>::value,
                    is_member_object_pointer<_MP>::value>
{
//     typedef ... _ClassType;
//     typedef ... _ReturnType;
};

// result_of

template <class _Callable> class result_of;

#ifdef _LIBCPP_HAS_NO_VARIADICS

template <class _Fn, bool, bool>
class __result_of
{
};

template <class _Fn>
class __result_of<_Fn(), true, false>
{
public:
    typedef decltype(declval<_Fn>()()) type;
};

template <class _Fn, class _A0>
class __result_of<_Fn(_A0), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>())) type;
};

template <class _Fn, class _A0, class _A1>
class __result_of<_Fn(_A0, _A1), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
};

template <class _Fn, class _A0, class _A1, class _A2>
class __result_of<_Fn(_A0, _A1, _A2), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
};

template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
struct __result_of_mp;

// member function pointer

template <class _MP, class _Tp>
struct __result_of_mp<_MP, _Tp, true>
    : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
{
};

// member data pointer

template <class _MP, class _Tp, bool>
struct __result_of_mdp;

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
    typedef typename __apply_cv<_Tp, _Rp>::type& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mp<_Rp _Class::*, _Tp, false>
    : public __result_of_mdp<_Rp _Class::*, _Tp,
            is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};



template <class _Fn, class _Tp>
class __result_of<_Fn(_Tp), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0>
class __result_of<_Fn(_Tp, _A0), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0, class _A1>
class __result_of<_Fn(_Tp, _A0, _A1), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

// result_of

template <class _Fn>
class _LIBCPP_TYPE_VIS result_of<_Fn()>
    : public __result_of<_Fn(),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0>
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0)>
    : public __result_of<_Fn(_A0),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0, class _A1>
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0, _A1)>
    : public __result_of<_Fn(_A0, _A1),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0, class _A1, class _A2>
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0, _A1, _A2)>
    : public __result_of<_Fn(_A0, _A1, _A2),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

#ifndef _LIBCPP_HAS_NO_VARIADICS

// template <class T, class... Args> struct is_constructible;

//      main is_constructible test

template<typename, typename T> struct __select_2nd { typedef T type; };

template <class _Tp, class ..._Args>
typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type
__is_constructible_test(_Tp&&, _Args&& ...);

template <class ..._Args>
false_type
__is_constructible_test(__any, _Args&& ...);

template <bool, class _Tp, class... _Args>
struct __is_constructible // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
             >::type
    {};

//      function types are not constructible

template <class _Rp, class... _A1, class... _A2>
struct __is_constructible<false, _Rp(_A1...), _A2...>
    : public false_type
    {};

//      handle scalars and reference types

//      Scalars are default constructible, references are not

template <class _Tp>
struct __is_constructible<true, _Tp>
    : public is_scalar<_Tp>
    {};

//      Scalars and references are constructible from one arg if that arg is
//          implicitly convertible to the scalar or reference.

template <class _Tp>
struct __is_constructible_ref
{
    true_type static __lxx(_Tp);
    false_type static __lxx(...);
};

template <class _Tp, class _A0>
struct __is_constructible<true, _Tp, _A0>
    : public common_type
             <
                 decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
             >::type
    {};

//      Scalars and references are not constructible from multiple args.

template <class _Tp, class _A0, class ..._Args>
struct __is_constructible<true, _Tp, _A0, _Args...>
    : public false_type
    {};

//      Treat scalars and reference types separately

template <bool, class _Tp, class... _Args>
struct __is_constructible_void_check
    : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _Args...>
    {};

//      If any of T or Args is void, is_constructible should be false

template <class _Tp, class... _Args>
struct __is_constructible_void_check<true, _Tp, _Args...>
    : public false_type
    {};

template <class ..._Args> struct __contains_void;

template <> struct __contains_void<> : false_type {};

template <class _A0, class ..._Args>
struct __contains_void<_A0, _Args...>
{
    static const bool value = is_void<_A0>::value ||
                              __contains_void<_Args...>::value;
};

//      is_constructible entry point

template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS is_constructible
    : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
                                        || is_abstract<_Tp>::value,
                                           _Tp, _Args...>
    {};

//      Array types are default constructible if their element type
//      is default constructible

template <class _Ap, size_t _Np>
struct __is_constructible<false, _Ap[_Np]>
    : public is_constructible<typename remove_all_extents<_Ap>::type>
    {};

//      Otherwise array types are not constructible by this syntax

template <class _Ap, size_t _Np, class ..._Args>
struct __is_constructible<false, _Ap[_Np], _Args...>
    : public false_type
    {};

//      Incomplete array types are not constructible

template <class _Ap, class ..._Args>
struct __is_constructible<false, _Ap[], _Args...>
    : public false_type
    {};

#else  // _LIBCPP_HAS_NO_VARIADICS

// template <class T> struct is_constructible0;

//      main is_constructible0 test

template <class _Tp>
decltype((_Tp(), true_type()))
__is_constructible0_test(_Tp&);

false_type
__is_constructible0_test(__any);

template <class _Tp, class _A0>
decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
__is_constructible1_test(_Tp&, _A0&);

template <class _A0>
false_type
__is_constructible1_test(__any, _A0&);

template <class _Tp, class _A0, class _A1>
decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
__is_constructible2_test(_Tp&, _A0&, _A1&);

template <class _A0, class _A1>
false_type
__is_constructible2_test(__any, _A0&, _A1&);

template <bool, class _Tp>
struct __is_constructible0_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible0_test(declval<_Tp&>()))
             >::type
    {};

template <bool, class _Tp, class _A0>
struct __is_constructible1_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
             >::type
    {};

template <bool, class _Tp, class _A0, class _A1>
struct __is_constructible2_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
             >::type
    {};

//      handle scalars and reference types

//      Scalars are default constructible, references are not

template <class _Tp>
struct __is_constructible0_imp<true, _Tp>
    : public is_scalar<_Tp>
    {};

template <class _Tp, class _A0>
struct __is_constructible1_imp<true, _Tp, _A0>
    : public is_convertible<_A0, _Tp>
    {};

template <class _Tp, class _A0, class _A1>
struct __is_constructible2_imp<true, _Tp, _A0, _A1>
    : public false_type
    {};

//      Treat scalars and reference types separately

template <bool, class _Tp>
struct __is_constructible0_void_check
    : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp>
    {};

template <bool, class _Tp, class _A0>
struct __is_constructible1_void_check
    : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _A0>
    {};

template <bool, class _Tp, class _A0, class _A1>
struct __is_constructible2_void_check
    : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _A0, _A1>
    {};

//      If any of T or Args is void, is_constructible should be false

template <class _Tp>
struct __is_constructible0_void_check<true, _Tp>
    : public false_type
    {};

template <class _Tp, class _A0>
struct __is_constructible1_void_check<true, _Tp, _A0>
    : public false_type
    {};

template <class _Tp, class _A0, class _A1>
struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
    : public false_type
    {};

//      is_constructible entry point

namespace __is_construct
{

struct __nat {};

}

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_TYPE_VIS is_constructible
    : public __is_constructible2_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value
                                        || is_void<_A0>::value
                                        || is_void<_A1>::value,
                                           _Tp, _A0, _A1>
    {};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
    : public __is_constructible0_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value,
                                           _Tp>
    {};

template <class _Tp, class _A0>
struct _LIBCPP_TYPE_VIS is_constructible<_Tp, _A0, __is_construct::__nat>
    : public __is_constructible1_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value
                                        || is_void<_A0>::value,
                                           _Tp, _A0>
    {};

//      Array types are default constructible if their element type
//      is default constructible

template <class _Ap, size_t _Np>
struct __is_constructible0_imp<false, _Ap[_Np]>
    : public is_constructible<typename remove_all_extents<_Ap>::type>
    {};

template <class _Ap, size_t _Np, class _A0>
struct __is_constructible1_imp<false, _Ap[_Np], _A0>
    : public false_type
    {};

template <class _Ap, size_t _Np, class _A0, class _A1>
struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
    : public false_type
    {};

//      Incomplete array types are not constructible

template <class _Ap>
struct __is_constructible0_imp<false, _Ap[]>
    : public false_type
    {};

template <class _Ap, class _A0>
struct __is_constructible1_imp<false, _Ap[], _A0>
    : public false_type
    {};

template <class _Ap, class _A0, class _A1>
struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
    : public false_type
    {};

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_default_constructible

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_default_constructible
    : public is_constructible<_Tp>
    {};

// is_copy_constructible

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_copy_constructible
    : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_move_constructible

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_copy_constructible<_Tp>
#endif
    {};

// is_trivially_constructible

#ifndef _LIBCPP_HAS_NO_VARIADICS

#if __has_feature(is_trivially_constructible)

template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS is_trivially_constructible
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS is_trivially_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp>
#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp>
#endif
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

#endif  // !__has_feature(is_trivially_constructible)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_TYPE_VIS is_trivially_constructible
    : false_type
{
};

#if __has_feature(is_trivially_constructible)

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp)>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

#endif  // !__has_feature(is_trivially_constructible)

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_trivially_default_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_default_constructible
    : public is_trivially_constructible<_Tp>
    {};

// is_trivially_copy_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copy_constructible
    : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_trivially_move_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_trivially_copy_constructible<_Tp>
#endif
    {};

// is_trivially_assignable

#if __has_feature(is_trivially_constructible)

template <class _Tp, class _Arg>
struct is_trivially_assignable
    : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp, class _Arg>
struct is_trivially_assignable
    : public false_type {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, const _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#endif  // !__has_feature(is_trivially_constructible)

// is_trivially_copy_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copy_assignable
    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
                               const typename add_lvalue_reference<_Tp>::type>
    {};

// is_trivially_move_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_move_assignable
    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                     typename add_rvalue_reference<_Tp>::type>
#else
                                     typename add_lvalue_reference<_Tp>::type>
#endif
    {};

// is_trivially_destructible

#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_destructible
    : public integral_constant<bool, __has_trivial_destructor(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct __libcpp_trivial_destructor
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_reference<_Tp>::value> {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_destructible
    : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// is_nothrow_constructible

#ifndef _LIBCPP_HAS_NO_VARIADICS

#if __has_feature(cxx_noexcept)

template <bool, class _Tp, class... _Args> struct __is_nothrow_constructible;

template <class _Tp, class... _Args>
struct __is_nothrow_constructible<true, _Tp, _Args...>
    : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
{
};

template <class _Tp, class... _Args>
struct __is_nothrow_constructible<false, _Tp, _Args...>
    : public false_type
{
};

template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
    : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
{
};

template <class _Tp, size_t _Ns>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp[_Ns]>
    : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp>
#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp>
#endif
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, const _Tp&>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

#endif  // __has_feature(cxx_noexcept)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_nothrow_default_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_default_constructible
    : public is_nothrow_constructible<_Tp>
    {};

// is_nothrow_copy_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_copy_constructible
    : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_nothrow_move_constructible

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_nothrow_copy_constructible<_Tp>
#endif
    {};

// is_nothrow_assignable

#if __has_feature(cxx_noexcept)

template <bool, class _Tp, class _Arg> struct __is_nothrow_assignable;

template <class _Tp, class _Arg>
struct __is_nothrow_assignable<false, _Tp, _Arg>
    : public false_type
{
};

template <class _Tp, class _Arg>
struct __is_nothrow_assignable<true, _Tp, _Arg>
    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
{
};

template <class _Tp, class _Arg>
struct _LIBCPP_TYPE_VIS is_nothrow_assignable
    : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp, class _Arg>
struct _LIBCPP_TYPE_VIS is_nothrow_assignable
    : public false_type {};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, _Tp>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, _Tp&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct is_nothrow_assignable<_Tp&, _Tp&&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#endif  // __has_feature(cxx_noexcept)

// is_nothrow_copy_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_copy_assignable
    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
                               const typename add_lvalue_reference<_Tp>::type>
    {};

// is_nothrow_move_assignable

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_move_assignable
    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                     typename add_rvalue_reference<_Tp>::type>
#else
                                     typename add_lvalue_reference<_Tp>::type>
#endif
    {};

// is_nothrow_destructible

#if __has_feature(cxx_noexcept)

template <bool, class _Tp> struct __is_nothrow_destructible;

template <class _Tp>
struct __is_nothrow_destructible<false, _Tp>
    : public false_type
{
};

template <class _Tp>
struct __is_nothrow_destructible<true, _Tp>
    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_destructible
    : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
{
};

template <class _Tp, size_t _Ns>
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp[_Ns]>
    : public is_nothrow_destructible<_Tp>
{
};

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp&>
    : public true_type
{
};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp&&>
    : public true_type
{
};

#endif

#else

template <class _Tp> struct __libcpp_nothrow_destructor
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_reference<_Tp>::value> {};

template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_destructible
    : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};

#endif

// is_pod

#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_TYPE_VIS is_pod
    : public integral_constant<bool, __is_pod(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct _LIBCPP_TYPE_VIS is_pod
    : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value   &&
                                     is_trivially_copy_constructible<_Tp>::value      &&
                                     is_trivially_copy_assignable<_Tp>::value    &&
                                     is_trivially_destructible<_Tp>::value> {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// is_literal_type;

template <class _Tp> struct _LIBCPP_TYPE_VIS is_literal_type
#if __has_feature(is_literal)
    : public integral_constant<bool, __is_literal(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
                              is_reference<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_standard_layout;

template <class _Tp> struct _LIBCPP_TYPE_VIS is_standard_layout
#if __has_feature(is_standard_layout)
    : public integral_constant<bool, __is_standard_layout(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_trivially_copyable;

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copyable
#if __has_feature(is_trivially_copyable)
    : public integral_constant<bool, __is_trivially_copyable(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_trivial;

template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivial
#if __has_feature(is_trivial)
    : public integral_constant<bool, __is_trivial(_Tp)>
#else
    : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
                                 is_trivially_default_constructible<_Tp>::value>
#endif
    {};

#ifndef _LIBCPP_HAS_NO_VARIADICS

// Check for complete types

template <class ..._Tp> struct __check_complete;

template <>
struct __check_complete<>
{
};

template <class _Hp, class _T0, class ..._Tp>
struct __check_complete<_Hp, _T0, _Tp...>
    : private __check_complete<_Hp>,
      private __check_complete<_T0, _Tp...>
{
};

template <class _Hp>
struct __check_complete<_Hp, _Hp>
    : private __check_complete<_Hp>
{
};

template <class _Tp>
struct __check_complete<_Tp>
{
    static_assert(sizeof(_Tp) > 0, "Type must be complete.");
};

template <class _Tp>
struct __check_complete<_Tp&>
    : private __check_complete<_Tp>
{
};

template <class _Tp>
struct __check_complete<_Tp&&>
    : private __check_complete<_Tp>
{
};

template <class _Rp, class ..._Param>
struct __check_complete<_Rp (*)(_Param...)>
    : private __check_complete<_Rp>
{
};

template <class _Rp, class ..._Param>
struct __check_complete<_Rp (_Param...)>
    : private __check_complete<_Rp>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...)>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
    : private __check_complete<_Class>
{
};

#if __has_feature(cxx_reference_qualified_functions)

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
    : private __check_complete<_Class>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
    : private __check_complete<_Class>
{
};

#endif

template <class _Rp, class _Class>
struct __check_complete<_Rp _Class::*>
    : private __check_complete<_Class>
{
};

// __invoke forward declarations

// fall back - none of the bullets

template <class ..._Args>
auto
__invoke(__any, _Args&& ...__args)
    -> __nat;

// bullets 1 and 2

template <class _Fp, class _A0, class ..._Args,
            class = typename enable_if
            <
                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
                is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
    -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));

template <class _Fp, class _A0, class ..._Args,
            class = typename enable_if
            <
                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
                !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
    -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));

// bullets 3 and 4

template <class _Fp, class _A0,
            class = typename enable_if
            <
                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
                is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
    -> decltype(_VSTD::forward<_A0>(__a0).*__f);

template <class _Fp, class _A0,
            class = typename enable_if
            <
                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
                !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
    -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);

// bullet 5

template <class _Fp, class ..._Args>
_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _Args&& ...__args)
    -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));

// __invokable

template <class _Fp, class ..._Args>
struct __invokable_imp
    : private __check_complete<_Fp>
{
    typedef decltype(
            __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
                    ) type;
    static const bool value = !is_same<type, __nat>::value;
};

template <class _Fp, class ..._Args>
struct __invokable
    : public integral_constant<bool,
          __invokable_imp<_Fp, _Args...>::value>
{
};

// __invoke_of

template <bool _Invokable, class _Fp, class ..._Args>
struct __invoke_of_imp  // false
{
};

template <class _Fp, class ..._Args>
struct __invoke_of_imp<true, _Fp, _Args...>
{
    typedef typename __invokable_imp<_Fp, _Args...>::type type;
};

template <class _Fp, class ..._Args>
struct __invoke_of
    : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
{
};

template <class _Fp, class ..._Args>
class _LIBCPP_TYPE_VIS result_of<_Fp(_Args...)>
    : public __invoke_of<_Fp, _Args...>
{
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
#endif

#endif  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
typename enable_if
<
    is_move_constructible<_Tp>::value &&
    is_move_assignable<_Tp>::value
>::type
#else
void
#endif
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
                                    is_nothrow_move_assignable<_Tp>::value)
{
    _Tp __t(_VSTD::move(__x));
    __x = _VSTD::move(__y);
    __y = _VSTD::move(__t);
}

template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
    //                                  _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
               _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
                                          *_VSTD::declval<_ForwardIterator2>())))
{
    swap(*__a, *__b);
}

// __swappable

namespace __detail
{

using _VSTD::swap;
__nat swap(__any, __any);

template <class _Tp>
struct __swappable
{
    typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type;
    static const bool value = !is_same<type, __nat>::value;
};

}  // __detail

template <class _Tp>
struct __is_swappable
    : public integral_constant<bool, __detail::__swappable<_Tp>::value>
{
};

#if __has_feature(cxx_noexcept)

template <bool, class _Tp>
struct __is_nothrow_swappable_imp
    : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(),
                                                   _VSTD::declval<_Tp&>()))>
{
};

template <class _Tp>
struct __is_nothrow_swappable_imp<false, _Tp>
    : public false_type
{
};

template <class _Tp>
struct __is_nothrow_swappable
    : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp>
struct __is_nothrow_swappable
    : public false_type
{
};

#endif  // __has_feature(cxx_noexcept)

#ifdef _LIBCXX_UNDERLYING_TYPE

template <class _Tp>
struct underlying_type
{
    typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
#endif

#else  // _LIBCXX_UNDERLYING_TYPE

template <class _Tp, bool _Support = false>
struct underlying_type
{
    static_assert(_Support, "The underyling_type trait requires compiler "
                            "support. Either no such support exists or "
                            "libc++ does not know how to use it.");
};

#endif // _LIBCXX_UNDERLYING_TYPE

_LIBCPP_END_NAMESPACE_STD

#endif  // _LIBCPP_TYPE_TRAITS
@


1.7
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/249998
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d140 58
d215 4
d222 5
d261 3
d269 3
d277 3
d525 4
d542 4
d551 4
d563 4
d576 4
d588 4
d621 4
d630 4
d695 4
d708 4
d1035 1
a1035 1
template <size_t _Len, const size_t _Align = __find_max_align<__all_types, _Len>::value>
d1047 5
d1113 4
d1278 4
d1307 4
d1369 4
d1551 4
d1797 1
a1797 1
    : public __member_pointer_traits_imp<_MP,
d3022 8
a3029 1
template <class _Fp, class _A0, class ..._Args>
d3035 8
a3042 1
template <class _Fp, class _A0, class ..._Args>
d3050 8
a3057 1
template <class _Fp, class _A0>
d3063 8
a3070 1
template <class _Fp, class _A0>
d3128 4
d3226 4
@


1.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246487
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d132 1
d153 1
a153 1
    struct _LIBCPP_VISIBLE conditional {typedef _If type;};
d155 1
a155 1
    struct _LIBCPP_VISIBLE conditional<false, _If, _Then> {typedef _Then type;};
d157 2
a158 2
template <bool, class _Tp = void> struct _LIBCPP_VISIBLE enable_if {};
template <class _Tp> struct _LIBCPP_VISIBLE enable_if<true, _Tp> {typedef _Tp type;};
d165 1
a165 1
struct _LIBCPP_VISIBLE integral_constant
d182 2
a183 2
template <class _Tp> struct _LIBCPP_VISIBLE is_const            : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_const<_Tp const> : public true_type {};
d187 2
a188 2
template <class _Tp> struct _LIBCPP_VISIBLE is_volatile               : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_volatile<_Tp volatile> : public true_type {};
d192 2
a193 2
template <class _Tp> struct _LIBCPP_VISIBLE remove_const            {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_const<const _Tp> {typedef _Tp type;};
d197 2
a198 2
template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile               {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile<volatile _Tp> {typedef _Tp type;};
d202 1
a202 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_cv
d210 1
a210 1
template <class _Tp> struct _LIBCPP_VISIBLE is_void
d218 1
a218 1
template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
d242 1
a242 1
template <class _Tp> struct _LIBCPP_VISIBLE is_integral
d252 1
a252 1
template <class _Tp> struct _LIBCPP_VISIBLE is_floating_point
d257 1
a257 1
template <class _Tp> struct _LIBCPP_VISIBLE is_array
d259 1
a259 1
template <class _Tp> struct _LIBCPP_VISIBLE is_array<_Tp[]>
d261 1
a261 1
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE is_array<_Tp[_Np]>
d269 1
a269 1
template <class _Tp> struct _LIBCPP_VISIBLE is_pointer
d274 2
a275 2
template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference       : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference<_Tp&> : public true_type {};
d277 1
a277 1
template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference        : public false_type {};
d279 1
a279 1
template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference<_Tp&&> : public true_type {};
d282 2
a283 2
template <class _Tp> struct _LIBCPP_VISIBLE is_reference        : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&>  : public true_type {};
d285 1
a285 1
template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&&> : public true_type {};
d296 1
a296 1
template <class _Tp> struct _LIBCPP_VISIBLE is_union
d302 1
a302 1
template <class _Tp> struct _LIBCPP_VISIBLE is_union
d311 1
a311 1
template <class _Tp> struct _LIBCPP_VISIBLE is_class
d322 1
a322 1
template <class _Tp> struct _LIBCPP_VISIBLE is_class
d329 2
a330 2
template <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same           : public false_type {};
template <class _Tp>            struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {};
d351 1
a351 1
template <class _Tp> struct _LIBCPP_VISIBLE is_function
d359 1
a359 1
template <class _Tp> struct _LIBCPP_VISIBLE is_member_function_pointer
d367 1
a367 1
template <class _Tp> struct _LIBCPP_VISIBLE is_member_pointer
d372 1
a372 1
template <class _Tp> struct _LIBCPP_VISIBLE is_member_object_pointer
d380 1
a380 1
template <class _Tp> struct _LIBCPP_VISIBLE is_enum
d385 1
a385 1
template <class _Tp> struct _LIBCPP_VISIBLE is_enum
d401 1
a401 1
template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
d407 1
a407 1
template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
d414 1
a414 1
template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
d421 1
a421 1
template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
d425 1
a425 1
template <class _Tp> struct _LIBCPP_VISIBLE is_object
d433 1
a433 1
template <class _Tp> struct _LIBCPP_VISIBLE is_compound
d446 1
a446 1
template <class _Tp> struct _LIBCPP_VISIBLE add_const
d459 1
a459 1
template <class _Tp> struct _LIBCPP_VISIBLE add_volatile
d464 1
a464 1
template <class _Tp> struct _LIBCPP_VISIBLE add_cv
d469 2
a470 2
template <class _Tp> struct _LIBCPP_VISIBLE remove_reference        {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&>  {typedef _Tp type;};
d472 1
a472 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&&> {typedef _Tp type;};
d477 6
a482 6
template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference                      {typedef _Tp& type;};
template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<const volatile void> {typedef const volatile void type;};
d486 5
a490 5
template <class _Tp> struct _LIBCPP_VISIBLE  add_rvalue_reference                     {typedef _Tp&& type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<const volatile void> {typedef const volatile void type;};
d515 5
a519 5
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer                      {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp*>                {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const>          {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* volatile>       {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const volatile> {typedef _Tp type;};
d523 1
a523 1
template <class _Tp> struct _LIBCPP_VISIBLE add_pointer
d539 1
a539 1
template <class _Tp> struct _LIBCPP_VISIBLE is_signed : public __is_signed<_Tp> {};
d554 1
a554 1
template <class _Tp> struct _LIBCPP_VISIBLE is_unsigned : public __is_unsigned<_Tp> {};
d558 1
a558 1
template <class _Tp> struct _LIBCPP_VISIBLE rank
d560 1
a560 1
template <class _Tp> struct _LIBCPP_VISIBLE rank<_Tp[]>
d562 1
a562 1
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE rank<_Tp[_Np]>
d567 1
a567 1
template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_VISIBLE extent
d569 1
a569 1
template <class _Tp> struct _LIBCPP_VISIBLE extent<_Tp[], 0>
d571 1
a571 1
template <class _Tp, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[], _Ip>
d573 1
a573 1
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE extent<_Tp[_Np], 0>
d575 1
a575 1
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[_Np], _Ip>
d580 1
a580 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_extent
d582 1
a582 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_extent<_Tp[]>
d584 1
a584 1
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_extent<_Tp[_Np]>
d589 1
a589 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents
d591 1
a591 1
template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[]>
d593 1
a593 1
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]>
d609 1
a609 1
template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {};
d616 1
a616 1
struct _LIBCPP_VISIBLE is_base_of
d640 1
a640 1
struct _LIBCPP_VISIBLE is_base_of
d650 1
a650 1
template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
d756 1
a756 1
template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
d770 1
a770 1
struct _LIBCPP_VISIBLE is_empty
d792 1
a792 1
template <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {};
d801 1
a801 1
struct _LIBCPP_VISIBLE is_polymorphic
d806 4
a809 2
template <class _Tp> struct __is_polymorphic1 : public _Tp {};
template <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();};
d811 2
a812 8
template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_polymorphic
    : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == sizeof(__is_polymorphic2<_Tp>)> {};

template <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic
    : public __libcpp_polymorphic<_Tp> {};
d820 1
a820 1
template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
d825 1
a825 1
template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
d832 2
a833 4
template <class _Tp> struct __alignment_of {_Tp __lx;};

template <class _Tp> struct _LIBCPP_VISIBLE alignment_of
    : public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {};
d920 1
a920 1
struct _LIBCPP_VISIBLE aligned_storage
d933 1
a933 1
struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\
d962 32
d1148 1
a1148 1
struct _LIBCPP_VISIBLE make_signed
d1173 1
a1173 1
struct _LIBCPP_VISIBLE make_unsigned
d1181 1
a1181 1
struct _LIBCPP_VISIBLE common_type
d1188 1
a1188 1
struct _LIBCPP_VISIBLE common_type<_Tp, void, void>
d1195 1
a1195 1
struct _LIBCPP_VISIBLE common_type<_Tp, _Up, void>
d1214 1
a1214 1
struct _LIBCPP_VISIBLE common_type<_Tp>
d1220 1
a1220 1
struct _LIBCPP_VISIBLE common_type<_Tp, _Up>
d1231 1
a1231 1
struct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...>
d1275 1
a1275 1
template <class _Tp> struct _LIBCPP_VISIBLE is_copy_assignable
d1281 1
a1281 1
template <class _Tp> struct _LIBCPP_VISIBLE is_move_assignable
d1396 1
a1396 1
struct _LIBCPP_VISIBLE decay
d1775 1
a1775 1
class _LIBCPP_VISIBLE result_of<_Fn()>
d1785 1
a1785 1
class _LIBCPP_VISIBLE result_of<_Fn(_A0)>
d1795 1
a1795 1
class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)>
d1805 1
a1805 1
class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)>
d1910 1
a1910 1
struct _LIBCPP_VISIBLE is_constructible
d2058 1
a2058 1
struct _LIBCPP_VISIBLE is_constructible
d2068 1
a2068 1
struct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
d2076 1
a2076 1
struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat>
d2124 1
a2124 1
struct _LIBCPP_VISIBLE is_default_constructible
d2131 1
a2131 1
struct _LIBCPP_VISIBLE is_copy_constructible
d2138 1
a2138 1
struct _LIBCPP_VISIBLE is_move_constructible
d2153 1
a2153 1
struct _LIBCPP_VISIBLE is_trivially_constructible
d2161 1
a2161 1
struct _LIBCPP_VISIBLE is_trivially_constructible
d2167 1
a2167 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp>
d2178 1
a2178 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&>
d2180 1
a2180 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
d2187 1
a2187 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
d2193 1
a2193 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
d2204 1
a2204 1
struct _LIBCPP_VISIBLE is_trivially_constructible
d2212 1
a2212 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
d2219 1
a2219 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
d2226 1
a2226 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
d2233 1
a2233 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
d2242 1
a2242 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
d2249 1
a2249 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
d2256 1
a2256 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
d2263 1
a2263 1
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
d2275 1
a2275 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_default_constructible
d2281 1
a2281 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_constructible
d2287 1
a2287 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible
d2335 1
a2335 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable
d2342 1
a2342 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_assignable
d2355 1
a2355 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
d2364 1
a2364 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
d2390 1
a2390 1
struct _LIBCPP_VISIBLE is_nothrow_constructible
d2396 1
a2396 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]>
d2404 1
a2404 1
struct _LIBCPP_VISIBLE is_nothrow_constructible
d2410 1
a2410 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp>
d2421 1
a2421 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&>
d2423 1
a2423 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp>
d2434 1
a2434 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&>
d2444 1
a2444 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&>
d2459 1
a2459 1
struct _LIBCPP_VISIBLE is_nothrow_constructible
d2465 1
a2465 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat,
d2476 1
a2476 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp,
d2487 1
a2487 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&,
d2498 1
a2498 1
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&,
d2512 1
a2512 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_default_constructible
d2518 1
a2518 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_constructible
d2524 1
a2524 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_constructible
d2551 1
a2551 1
struct _LIBCPP_VISIBLE is_nothrow_assignable
d2559 1
a2559 1
struct _LIBCPP_VISIBLE is_nothrow_assignable
d2563 1
a2563 1
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp>
d2571 1
a2571 1
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&>
d2579 1
a2579 1
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&>
d2602 1
a2602 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_assignable
d2609 1
a2609 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_assignable
d2637 1
a2637 1
struct _LIBCPP_VISIBLE is_nothrow_destructible
d2643 1
a2643 1
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]>
d2649 1
a2649 1
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&>
d2657 1
a2657 1
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&>
d2670 1
a2670 1
template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_destructible
d2679 1
a2679 1
template <class _Tp> struct _LIBCPP_VISIBLE is_pod
d2684 1
a2684 1
template <class _Tp> struct _LIBCPP_VISIBLE is_pod
d2694 1
a2694 1
template <class _Tp> struct _LIBCPP_VISIBLE is_literal_type
d2705 1
a2705 1
template <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout
d2715 1
a2715 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copyable
d2725 1
a2725 1
template <class _Tp> struct _LIBCPP_VISIBLE is_trivial
d2954 1
a2954 1
class _LIBCPP_VISIBLE result_of<_Fp(_Args...)>
@


1.5
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/242945
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242945 | theraven | 2012-11-13 03:27:43 +0000 (Tue, 13 Nov 2012) | 2 lines
## SVN ##
## SVN ## Import new version of libc++ into base.
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d620 22
a641 1
#error is_base_of not implemented.
@


1.4
log
@SVN rev 241903 on 2012-10-22 18:25:04Z by dim

Import libc++ trunk r165949.  Among other improvements and bug fixes,
this has many visibility problems fixed, which should help with
compiling certain ports that exercise C++11 mode (i.e. Firefox).

Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files,
which are referred to in all the source files.

MFC after:	1 month
@
text
@d159 1
a159 1
struct __two {char _[2];};
d757 1
a757 1
    double _;
d762 1
a762 1
    double _;
d814 1
a814 1
template <class _Tp> struct __alignment_of {_Tp _;};
d845 2
a846 2
struct __struct_double {long double _;};
struct __struct_double4 {double _[4];};
d921 1
a921 1
        unsigned char _[_Len];\
d1774 2
d1777 1
a1777 1
decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
d1814 2
a1815 2
    true_type static __(_Tp);
    false_type static __(...);
d1822 1
a1822 1
                 decltype(__is_constructible_ref<_Tp>::__(declval<_A0>()))
@


1.3
log
@SVN rev 234976 on 2012-05-03 17:44:07Z by theraven

Import new version of libc++.  Among other improvements, this comes with an
<atomic> header that works with clang 3.1 (and, importantly, the pre-3.1
snapshot currently in head)
@
text
@d610 14
d629 2
a630 1
    : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
a635 3
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> char  __test(const volatile typename remove_reference<_Tp>::type&&);
#else
a636 1
#endif
d671 1
d673 9
d711 1
a742 14
// is_base_of

#ifdef _LIBCP_HAS_IS_BASE_OF

template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
    : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};

#else  // __has_feature(is_base_of)

#error is_base_of not implemented.

#endif  // __has_feature(is_base_of)

d1620 2
a1626 66
#ifndef _LIBCPP_HAS_NO_VARIADICS

template <class _Fn, class ..._ArgTypes>
class __result_of<_Fn(_ArgTypes...), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type;
};

template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
struct __result_of_mp;

// member function pointer

template <class _MP, class _Tp>
struct __result_of_mp<_MP, _Tp, true>
    : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
{
};

// member data pointer

template <class _MP, class _Tp, bool>
struct __result_of_mdp;

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
    typedef typename __apply_cv<_Tp, _Rp>::type&& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mp<_Rp _Class::*, _Tp, false>
    : public __result_of_mdp<_Rp _Class::*, _Tp,
            is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};

template <class _Fn, class _Tp, class ..._ArgTypes>
class __result_of<_Fn(_Tp, _ArgTypes...), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

// result_of

template <class _Fn, class ..._ArgTypes>
class _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)>
    : public __result_of<_Fn(_ArgTypes...),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

#else  // _LIBCPP_HAS_NO_VARIADICS

d2728 1
a2728 1
    : private __check_complete<_Param...>
d2734 1
a2734 1
    : private __check_complete<_Param...>
d2740 1
a2740 1
    : private __check_complete<_Class, _Param...>
d2746 1
a2746 1
    : private __check_complete<_Class, _Param...>
d2752 1
a2752 1
    : private __check_complete<_Class, _Param...>
d2758 1
a2758 1
    : private __check_complete<_Class, _Param...>
d2766 1
a2766 1
    : private __check_complete<_Class, _Param...>
d2772 1
a2772 1
    : private __check_complete<_Class, _Param...>
d2778 1
a2778 1
    : private __check_complete<_Class, _Param...>
d2784 1
a2784 1
    : private __check_complete<_Class, _Param...>
d2790 1
a2790 1
    : private __check_complete<_Class, _Param...>
d2796 1
a2796 1
    : private __check_complete<_Class, _Param...>
d2802 1
a2802 1
    : private __check_complete<_Class, _Param...>
d2808 1
a2808 1
    : private __check_complete<_Class, _Param...>
d2832 1
d2838 1
d2846 1
d2852 1
d2860 1
d2869 1
a2869 1
    : private __check_complete<_Fp, _Args...>
d2903 6
@


1.3.2.1
log
@file type_traits was added on branch RELENG_9 on 2012-05-22 18:32:26 +0000
@
text
@d1 3062
@


1.3.2.2
log
@SVN rev 235798 on 2012-05-22 18:30:14Z by theraven

Merged libcxxrt and libc++.  Now available for testing on 9-stable with
-stdlib=libc++.  Changes to libstdc++ not yet merged, so it is not yet possible
to mix libstdc++ and libc++ in the same program.

Merged revisions: 226702,226785,227006,227755,227983,227987,228531,228630,228761,229067,230127,232950,233098,234715-234716,234772
@
text
@a0 3062
// -*- C++ -*-
//===------------------------ type_traits ---------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_TYPE_TRAITS
#define _LIBCPP_TYPE_TRAITS

/*
    type_traits synopsis

namespace std
{

    // helper class:
    template <class T, T v> struct integral_constant;
    typedef integral_constant<bool, true>  true_type;
    typedef integral_constant<bool, false> false_type;

    // helper traits
    template <bool, class T = void> struct enable_if;
    template <bool, class T, class F> struct conditional;

    // Primary classification traits:
    template <class T> struct is_void;
    template <class T> struct is_integral;
    template <class T> struct is_floating_point;
    template <class T> struct is_array;
    template <class T> struct is_pointer;
    template <class T> struct is_lvalue_reference;
    template <class T> struct is_rvalue_reference;
    template <class T> struct is_member_object_pointer;
    template <class T> struct is_member_function_pointer;
    template <class T> struct is_enum;
    template <class T> struct is_union;
    template <class T> struct is_class;
    template <class T> struct is_function;

    // Secondary classification traits:
    template <class T> struct is_reference;
    template <class T> struct is_arithmetic;
    template <class T> struct is_fundamental;
    template <class T> struct is_member_pointer;
    template <class T> struct is_scalar;
    template <class T> struct is_object;
    template <class T> struct is_compound;

    // Const-volatile properties and transformations:
    template <class T> struct is_const;
    template <class T> struct is_volatile;
    template <class T> struct remove_const;
    template <class T> struct remove_volatile;
    template <class T> struct remove_cv;
    template <class T> struct add_const;
    template <class T> struct add_volatile;
    template <class T> struct add_cv;

    // Reference transformations:
    template <class T> struct remove_reference;
    template <class T> struct add_lvalue_reference;
    template <class T> struct add_rvalue_reference;

    // Pointer transformations:
    template <class T> struct remove_pointer;
    template <class T> struct add_pointer;

    // Integral properties:
    template <class T> struct is_signed;
    template <class T> struct is_unsigned;
    template <class T> struct make_signed;
    template <class T> struct make_unsigned;

    // Array properties and transformations:
    template <class T> struct rank;
    template <class T, unsigned I = 0> struct extent;
    template <class T> struct remove_extent;
    template <class T> struct remove_all_extents;

    // Member introspection:
    template <class T> struct is_pod;
    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> struct is_empty;
    template <class T> struct is_polymorphic;
    template <class T> struct is_abstract;

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

    // Relationships between types:
    template <class T, class U> struct is_same;
    template <class Base, class Derived> struct is_base_of;
    template <class From, class To> struct is_convertible;

    // Alignment properties and transformations:
    template <class T> struct alignment_of;
    template <size_t Len, size_t Align = most_stringent_alignment_requirement>
        struct aligned_storage;

    template <class T> struct decay;
    template <class... T> struct common_type;
    template <class T> struct underlying_type;
    template <class> class result_of; // undefined
    template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>;

}  // std

*/
#include <__config>
#include <cstddef>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

template <bool _Bp, class _If, class _Then>
    struct _LIBCPP_VISIBLE conditional {typedef _If type;};
template <class _If, class _Then>
    struct _LIBCPP_VISIBLE conditional<false, _If, _Then> {typedef _Then type;};

template <bool, class _Tp = void> struct _LIBCPP_VISIBLE enable_if {};
template <class _Tp> struct _LIBCPP_VISIBLE enable_if<true, _Tp> {typedef _Tp type;};

struct __two {char _[2];};

// helper class:

template <class _Tp, _Tp __v>
struct _LIBCPP_VISIBLE integral_constant
{
    static _LIBCPP_CONSTEXPR const _Tp      value = __v;
    typedef _Tp               value_type;
    typedef integral_constant type;
    _LIBCPP_INLINE_VISIBILITY
        _LIBCPP_CONSTEXPR operator value_type() const {return value;}
};

template <class _Tp, _Tp __v>
_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;

typedef integral_constant<bool, true>  true_type;
typedef integral_constant<bool, false> false_type;

// is_const

template <class _Tp> struct _LIBCPP_VISIBLE is_const            : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_const<_Tp const> : public true_type {};

// is_volatile

template <class _Tp> struct _LIBCPP_VISIBLE is_volatile               : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_volatile<_Tp volatile> : public true_type {};

// remove_const

template <class _Tp> struct _LIBCPP_VISIBLE remove_const            {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_const<const _Tp> {typedef _Tp type;};

// remove_volatile

template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile               {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile<volatile _Tp> {typedef _Tp type;};

// remove_cv

template <class _Tp> struct _LIBCPP_VISIBLE remove_cv
{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};

// is_void

template <class _Tp> struct __is_void       : public false_type {};
template <>          struct __is_void<void> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_void
    : public __is_void<typename remove_cv<_Tp>::type> {};

// __is_nullptr_t

template <class _Tp> struct ____is_nullptr_t       : public false_type {};
template <>          struct ____is_nullptr_t<nullptr_t> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
    : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};

// is_integral

template <class _Tp> struct __is_integral                     : public false_type {};
template <>          struct __is_integral<bool>               : public true_type {};
template <>          struct __is_integral<char>               : public true_type {};
template <>          struct __is_integral<signed char>        : public true_type {};
template <>          struct __is_integral<unsigned char>      : public true_type {};
template <>          struct __is_integral<wchar_t>            : public true_type {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>          struct __is_integral<char16_t>           : public true_type {};
template <>          struct __is_integral<char32_t>           : public true_type {};
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
template <>          struct __is_integral<short>              : public true_type {};
template <>          struct __is_integral<unsigned short>     : public true_type {};
template <>          struct __is_integral<int>                : public true_type {};
template <>          struct __is_integral<unsigned int>       : public true_type {};
template <>          struct __is_integral<long>               : public true_type {};
template <>          struct __is_integral<unsigned long>      : public true_type {};
template <>          struct __is_integral<long long>          : public true_type {};
template <>          struct __is_integral<unsigned long long> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_integral
    : public __is_integral<typename remove_cv<_Tp>::type> {};

// is_floating_point

template <class _Tp> struct __is_floating_point              : public false_type {};
template <>          struct __is_floating_point<float>       : public true_type {};
template <>          struct __is_floating_point<double>      : public true_type {};
template <>          struct __is_floating_point<long double> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_floating_point
    : public __is_floating_point<typename remove_cv<_Tp>::type> {};

// is_array

template <class _Tp> struct _LIBCPP_VISIBLE is_array
    : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_array<_Tp[]>
    : public true_type {};
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE is_array<_Tp[_Np]>
    : public true_type {};

// is_pointer

template <class _Tp> struct __is_pointer       : public false_type {};
template <class _Tp> struct __is_pointer<_Tp*> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_pointer
    : public __is_pointer<typename remove_cv<_Tp>::type> {};

// is_reference

template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference       : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference<_Tp&> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference        : public false_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference<_Tp&&> : public true_type {};
#endif

template <class _Tp> struct _LIBCPP_VISIBLE is_reference        : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&>  : public true_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&&> : public true_type {};
#endif

#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_TYPE_TRAITS
#endif

// is_union

#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE is_union
    : public integral_constant<bool, __is_union(_Tp)> {};

#else

template <class _Tp> struct __libcpp_union : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_union
    : public __libcpp_union<typename remove_cv<_Tp>::type> {};

#endif

// is_class

#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE is_class
    : public integral_constant<bool, __is_class(_Tp)> {};

#else

namespace __is_class_imp
{
template <class _Tp> char  __test(int _Tp::*);
template <class _Tp> __two __test(...);
}

template <class _Tp> struct _LIBCPP_VISIBLE is_class
    : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {};

#endif

// is_same

template <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same           : public false_type {};
template <class _Tp>            struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {};

// is_function

namespace __is_function_imp
{
template <class _Tp> char  __test(_Tp*);
template <class _Tp> __two __test(...);
template <class _Tp> _Tp&  __source();
}

template <class _Tp, bool = is_class<_Tp>::value ||
                            is_union<_Tp>::value ||
                            is_void<_Tp>::value  ||
                            is_reference<_Tp>::value ||
                            is_same<_Tp, nullptr_t>::value >
struct __is_function
    : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1>
    {};
template <class _Tp> struct __is_function<_Tp, true> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_function
    : public __is_function<_Tp> {};

// is_member_function_pointer

template <class _Tp> struct            __is_member_function_pointer             : public false_type {};
template <class _Tp, class _Up> struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};

template <class _Tp> struct _LIBCPP_VISIBLE is_member_function_pointer
    : public __is_member_function_pointer<typename remove_cv<_Tp>::type> {};

// is_member_pointer

template <class _Tp>            struct __is_member_pointer             : public false_type {};
template <class _Tp, class _Up> struct __is_member_pointer<_Tp _Up::*> : public true_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_member_pointer
    : public __is_member_pointer<typename remove_cv<_Tp>::type> {};

// is_member_object_pointer

template <class _Tp> struct _LIBCPP_VISIBLE is_member_object_pointer
    : public integral_constant<bool, is_member_pointer<_Tp>::value &&
                                    !is_member_function_pointer<_Tp>::value> {};

// is_enum

#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE is_enum
    : public integral_constant<bool, __is_enum(_Tp)> {};

#else

template <class _Tp> struct _LIBCPP_VISIBLE is_enum
    : public integral_constant<bool, !is_void<_Tp>::value             &&
                                     !is_integral<_Tp>::value         &&
                                     !is_floating_point<_Tp>::value   &&
                                     !is_array<_Tp>::value            &&
                                     !is_pointer<_Tp>::value          &&
                                     !is_reference<_Tp>::value        &&
                                     !is_member_pointer<_Tp>::value   &&
                                     !is_union<_Tp>::value            &&
                                     !is_class<_Tp>::value            &&
                                     !is_function<_Tp>::value         > {};

#endif

// is_arithmetic

template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
    : public integral_constant<bool, is_integral<_Tp>::value      ||
                                     is_floating_point<_Tp>::value> {};

// is_fundamental

template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
    : public integral_constant<bool, is_void<_Tp>::value        ||
                                     __is_nullptr_t<_Tp>::value ||
                                     is_arithmetic<_Tp>::value> {};

// is_scalar

template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
    : public integral_constant<bool, is_arithmetic<_Tp>::value     ||
                                     is_member_pointer<_Tp>::value ||
                                     is_pointer<_Tp>::value        ||
                                     __is_nullptr_t<_Tp>::value    ||
                                     is_enum<_Tp>::value           > {};

template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};

// is_object

template <class _Tp> struct _LIBCPP_VISIBLE is_object
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_array<_Tp>::value  ||
                                     is_union<_Tp>::value  ||
                                     is_class<_Tp>::value  > {};

// is_compound

template <class _Tp> struct _LIBCPP_VISIBLE is_compound
    : public integral_constant<bool, !is_fundamental<_Tp>::value> {};

// add_const

template <class _Tp, bool = is_reference<_Tp>::value ||
                            is_function<_Tp>::value  ||
                            is_const<_Tp>::value     >
struct __add_const             {typedef _Tp type;};

template <class _Tp>
struct __add_const<_Tp, false> {typedef const _Tp type;};

template <class _Tp> struct _LIBCPP_VISIBLE add_const
    {typedef typename __add_const<_Tp>::type type;};

// add_volatile

template <class _Tp, bool = is_reference<_Tp>::value ||
                            is_function<_Tp>::value  ||
                            is_volatile<_Tp>::value  >
struct __add_volatile             {typedef _Tp type;};

template <class _Tp>
struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};

template <class _Tp> struct _LIBCPP_VISIBLE add_volatile
    {typedef typename __add_volatile<_Tp>::type type;};

// add_cv

template <class _Tp> struct _LIBCPP_VISIBLE add_cv
    {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};

// remove_reference

template <class _Tp> struct _LIBCPP_VISIBLE remove_reference        {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&>  {typedef _Tp type;};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&&> {typedef _Tp type;};
#endif

// add_lvalue_reference

template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference                      {typedef _Tp& type;};
template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_VISIBLE add_lvalue_reference<const volatile void> {typedef const volatile void type;};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp> struct _LIBCPP_VISIBLE  add_rvalue_reference                     {typedef _Tp&& type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_VISIBLE add_rvalue_reference<const volatile void> {typedef const volatile void type;};

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
typename add_rvalue_reference<_Tp>::type
declval() _NOEXCEPT;

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
typename add_lvalue_reference<_Tp>::type
declval();

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

struct __any
{
    __any(...);
};

// remove_pointer

template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer                      {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp*>                {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const>          {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* volatile>       {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const volatile> {typedef _Tp type;};

// add_pointer

template <class _Tp> struct _LIBCPP_VISIBLE add_pointer
    {typedef typename remove_reference<_Tp>::type* type;};

// is_signed

template <class _Tp, bool = is_integral<_Tp>::value>
struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};

template <class _Tp>
struct ___is_signed<_Tp, false> : public true_type {};  // floating point

template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_signed : public ___is_signed<_Tp> {};

template <class _Tp> struct __is_signed<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_signed : public __is_signed<_Tp> {};

// is_unsigned

template <class _Tp, bool = is_integral<_Tp>::value>
struct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};

template <class _Tp>
struct ___is_unsigned<_Tp, false> : public false_type {};  // floating point

template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_unsigned : public ___is_unsigned<_Tp> {};

template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_unsigned : public __is_unsigned<_Tp> {};

// rank

template <class _Tp> struct _LIBCPP_VISIBLE rank
    : public integral_constant<size_t, 0> {};
template <class _Tp> struct _LIBCPP_VISIBLE rank<_Tp[]>
    : public integral_constant<size_t, rank<_Tp>::value + 1> {};
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE rank<_Tp[_Np]>
    : public integral_constant<size_t, rank<_Tp>::value + 1> {};

// extent

template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_VISIBLE extent
    : public integral_constant<size_t, 0> {};
template <class _Tp> struct _LIBCPP_VISIBLE extent<_Tp[], 0>
    : public integral_constant<size_t, 0> {};
template <class _Tp, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[], _Ip>
    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE extent<_Tp[_Np], 0>
    : public integral_constant<size_t, _Np> {};
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[_Np], _Ip>
    : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};

// remove_extent

template <class _Tp> struct _LIBCPP_VISIBLE remove_extent
    {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_extent<_Tp[]>
    {typedef _Tp type;};
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_extent<_Tp[_Np]>
    {typedef _Tp type;};

// remove_all_extents

template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents
    {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[]>
    {typedef typename remove_all_extents<_Tp>::type type;};
template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]>
    {typedef typename remove_all_extents<_Tp>::type type;};

// is_abstract

namespace __is_abstract_imp
{
template <class _Tp> char  __test(_Tp (*)[1]);
template <class _Tp> __two __test(...);
}

template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};

template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {};

// is_convertible

#if __has_feature(is_convertible_to)

template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
    : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};

#else  // __has_feature(is_convertible_to)

namespace __is_convertible_imp
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> char  __test(const volatile typename remove_reference<_Tp>::type&&);
#else
template <class _Tp> char  __test(_Tp);
#endif
template <class _Tp> __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> _Tp&& __source();
#else
template <class _Tp> typename remove_reference<_Tp>::type& __source();
#endif

template <class _Tp, bool _IsArray =    is_array<_Tp>::value,
                     bool _IsFunction = is_function<_Tp>::value,
                     bool _IsVoid =     is_void<_Tp>::value>
                     struct __is_array_function_or_void                          {enum {value = 0};};
template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
}

template <class _Tp,
    unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
struct __is_convertible_check
{
    static const size_t __v = 0;
};

template <class _Tp>
struct __is_convertible_check<_Tp, 0>
{
    static const size_t __v = sizeof(_Tp);
};

template <class _T1, class _T2,
    unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
    unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
struct __is_convertible
    : public integral_constant<bool,
        sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
    >
{};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};

template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {};
template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {};
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0>
    : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0>                : public false_type {};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1>            struct __is_convertible<_T1, _T1&&, 2, 0>               : public true_type {};
#endif
template <class _T1>            struct __is_convertible<_T1, _T1*, 2, 0>               : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*const, 2, 0>          : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*volatile, 2, 0>       : public true_type {};
template <class _T1>            struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};

template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};

template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
    : public __is_convertible<_T1, _T2>
{
    static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
    static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
};

#endif  // __has_feature(is_convertible_to)

// is_base_of

#ifdef _LIBCP_HAS_IS_BASE_OF

template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
    : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};

#else  // __has_feature(is_base_of)

#error is_base_of not implemented.

#endif  // __has_feature(is_base_of)

// is_empty

#if __has_feature(is_empty)

template <class _Tp>
struct _LIBCPP_VISIBLE is_empty
    : public integral_constant<bool, __is_empty(_Tp)> {};

#else  // __has_feature(is_empty)

template <class _Tp>
struct __is_empty1
    : public _Tp
{
    double _;
};

struct __is_empty2
{
    double _;
};

template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {};

template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {};

#endif  // __has_feature(is_empty)

// is_polymorphic

#if __has_feature(is_polymorphic)

template <class _Tp>
struct _LIBCPP_VISIBLE is_polymorphic
    : public integral_constant<bool, __is_polymorphic(_Tp)> {};

#else

template <class _Tp> struct __is_polymorphic1 : public _Tp {};
template <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();};

template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_polymorphic
    : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == sizeof(__is_polymorphic2<_Tp>)> {};

template <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type {};

template <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic
    : public __libcpp_polymorphic<_Tp> {};

#endif // __has_feature(is_polymorphic)

// has_virtual_destructor

#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
    : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
    : public false_type {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// alignment_of

template <class _Tp> struct __alignment_of {_Tp _;};

template <class _Tp> struct _LIBCPP_VISIBLE alignment_of
    : public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {};

// aligned_storage

template <class _Hp, class _Tp>
struct __type_list
{
    typedef _Hp _Head;
    typedef _Tp _Tail;
};

struct __nat
{
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
    __nat() = delete;
    __nat(const __nat&) = delete;
    __nat& operator=(const __nat&) = delete;
    ~__nat() = delete;
#endif
};

template <class _Tp>
struct __align_type
{
    static const size_t value = alignment_of<_Tp>::value;
    typedef _Tp type;
};

struct __struct_double {long double _;};
struct __struct_double4 {double _[4];};

typedef
    __type_list<__align_type<unsigned char>,
    __type_list<__align_type<unsigned short>,
    __type_list<__align_type<unsigned int>,
    __type_list<__align_type<unsigned long>,
    __type_list<__align_type<unsigned long long>,
    __type_list<__align_type<double>,
    __type_list<__align_type<long double>,
    __type_list<__align_type<__struct_double>,
    __type_list<__align_type<__struct_double4>,
    __type_list<__align_type<int*>,
    __nat
    > > > > > > > > > > __all_types;

template <class _TL, size_t _Align> struct __find_pod;

template <class _Hp, size_t _Align>
struct __find_pod<__type_list<_Hp, __nat>, _Align>
{
    typedef typename conditional<
                             _Align == _Hp::value,
                             typename _Hp::type,
                             void
                         >::type type;
};

template <class _Hp, class _Tp, size_t _Align>
struct __find_pod<__type_list<_Hp, _Tp>, _Align>
{
    typedef typename conditional<
                             _Align == _Hp::value,
                             typename _Hp::type,
                             typename __find_pod<_Tp, _Align>::type
                         >::type type;
};

template <class _TL, size_t _Len> struct __find_max_align;

template <class _Hp, size_t _Len>
struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};

template <size_t _Len, size_t _A1, size_t _A2>
struct __select_align
{
private:
    static const size_t __min = _A2 < _A1 ? _A2 : _A1;
    static const size_t __max = _A1 < _A2 ? _A2 : _A1;
public:
    static const size_t value = _Len < __max ? __min : __max;
};

template <class _Hp, class _Tp, size_t _Len>
struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
    : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};

template <size_t _Len, const size_t _Align = __find_max_align<__all_types, _Len>::value>
struct _LIBCPP_VISIBLE aligned_storage
{
    typedef typename __find_pod<__all_types, _Align>::type _Aligner;
    static_assert(!is_void<_Aligner>::value, "");
    union type
    {
        _Aligner __align;
        unsigned char __data[_Len];
    };
};

#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \
template <size_t _Len>\
struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\
{\
    struct _ALIGNAS(n) type\
    {\
        unsigned char _[_Len];\
    };\
}

_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
#if !defined(_MSC_VER)
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
#endif // !_MSC_VER

#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION

// __promote

template <class _A1, class _A2 = void, class _A3 = void,
          bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) &&
                 (is_arithmetic<_A2>::value || is_void<_A2>::value) &&
                 (is_arithmetic<_A3>::value || is_void<_A3>::value)>
class __promote {};

template <class _A1, class _A2, class _A3>
class __promote<_A1, _A2, _A3, true>
{
private:
    typedef typename __promote<_A1>::type __type1;
    typedef typename __promote<_A2>::type __type2;
    typedef typename __promote<_A3>::type __type3;
public:
    typedef decltype(__type1() + __type2() + __type3()) type;
};

template <class _A1, class _A2>
class __promote<_A1, _A2, void, true>
{
private:
    typedef typename __promote<_A1>::type __type1;
    typedef typename __promote<_A2>::type __type2;
public:
    typedef decltype(__type1() + __type2()) type;
};

template <class _A1>
class __promote<_A1, void, void, true>
{
public:
    typedef typename conditional<is_arithmetic<_A1>::value,
                     typename conditional<is_integral<_A1>::value, double, _A1>::type,
                     void
            >::type type;
};

#ifdef _LIBCPP_STORE_AS_OPTIMIZATION

// __transform

template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;};
template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char      type;};
template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short     type;};
template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int       type;};
template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;};

#endif  // _LIBCPP_STORE_AS_OPTIMIZATION

// make_signed / make_unsigned

typedef
    __type_list<signed char,
    __type_list<signed short,
    __type_list<signed int,
    __type_list<signed long,
    __type_list<signed long long,
    __nat
    > > > > > __signed_types;

typedef
    __type_list<unsigned char,
    __type_list<unsigned short,
    __type_list<unsigned int,
    __type_list<unsigned long,
    __type_list<unsigned long long,
    __nat
    > > > > > __unsigned_types;

template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;

template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
{
    typedef _Hp type;
};

template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
{
    typedef typename __find_first<_Tp, _Size>::type type;
};

template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
                             bool = is_volatile<typename remove_reference<_Tp>::type>::value>
struct __apply_cv
{
    typedef _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, false>
{
    typedef const _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, false, true>
{
    typedef volatile _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, true>
{
    typedef const volatile _Up type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, false>
{
    typedef _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, false>
{
    typedef const _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, true>
{
    typedef volatile _Up& type;
};

template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, true>
{
    typedef const volatile _Up& type;
};

template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_signed {};

template <class _Tp>
struct __make_signed<_Tp, true>
{
    typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
};

template <> struct __make_signed<bool,               true> {};
template <> struct __make_signed<  signed short,     true> {typedef short     type;};
template <> struct __make_signed<unsigned short,     true> {typedef short     type;};
template <> struct __make_signed<  signed int,       true> {typedef int       type;};
template <> struct __make_signed<unsigned int,       true> {typedef int       type;};
template <> struct __make_signed<  signed long,      true> {typedef long      type;};
template <> struct __make_signed<unsigned long,      true> {typedef long      type;};
template <> struct __make_signed<  signed long long, true> {typedef long long type;};
template <> struct __make_signed<unsigned long long, true> {typedef long long type;};

template <class _Tp>
struct _LIBCPP_VISIBLE make_signed
{
    typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
};

template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_unsigned {};

template <class _Tp>
struct __make_unsigned<_Tp, true>
{
    typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
};

template <> struct __make_unsigned<bool,               true> {};
template <> struct __make_unsigned<  signed short,     true> {typedef unsigned short     type;};
template <> struct __make_unsigned<unsigned short,     true> {typedef unsigned short     type;};
template <> struct __make_unsigned<  signed int,       true> {typedef unsigned int       type;};
template <> struct __make_unsigned<unsigned int,       true> {typedef unsigned int       type;};
template <> struct __make_unsigned<  signed long,      true> {typedef unsigned long      type;};
template <> struct __make_unsigned<unsigned long,      true> {typedef unsigned long      type;};
template <> struct __make_unsigned<  signed long long, true> {typedef unsigned long long type;};
template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};

template <class _Tp>
struct _LIBCPP_VISIBLE make_unsigned
{
    typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
};

#ifdef _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _Up = void, class V = void>
struct _LIBCPP_VISIBLE common_type
{
public:
    typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type;
};

template <class _Tp>
struct _LIBCPP_VISIBLE common_type<_Tp, void, void>
{
public:
    typedef _Tp type;
};

template <class _Tp, class _Up>
struct _LIBCPP_VISIBLE common_type<_Tp, _Up, void>
{
private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    static _Tp&& __t();
    static _Up&& __u();
#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
    static _Tp __t();
    static _Up __u();
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
    typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
};

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class ..._Tp> struct common_type;

template <class _Tp>
struct _LIBCPP_VISIBLE common_type<_Tp>
{
    typedef _Tp type;
};

template <class _Tp, class _Up>
struct _LIBCPP_VISIBLE common_type<_Tp, _Up>
{
private:
    static _Tp&& __t();
    static _Up&& __u();
    static bool __f();
public:
    typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type;
};

template <class _Tp, class _Up, class ..._Vp>
struct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...>
{
    typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_assignable

template <class _Tp, class _Arg>
decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type()))
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_assignable_test(_Tp&&, _Arg&&);
#else
__is_assignable_test(_Tp, _Arg&);
#endif

template <class _Arg>
false_type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_assignable_test(__any, _Arg&&);
#else
__is_assignable_test(__any, _Arg&);
#endif

template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
struct __is_assignable_imp
    : public common_type
        <
            decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
        >::type {};

template <class _Tp, class _Arg>
struct __is_assignable_imp<_Tp, _Arg, true>
    : public false_type
{
};

template <class _Tp, class _Arg>
struct is_assignable
    : public __is_assignable_imp<_Tp, _Arg> {};

// is_copy_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_copy_assignable
    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
                     const typename add_lvalue_reference<_Tp>::type> {};

// is_move_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_move_assignable
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
                     const typename add_rvalue_reference<_Tp>::type> {};
#else
    : public is_copy_assignable<_Tp> {};
#endif

// is_destructible

template <class _Tp>
struct __destructible_test
{
    _Tp __t;
};

template <class _Tp>
decltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type()))
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__is_destructible_test(_Tp&&);
#else
__is_destructible_test(_Tp&);
#endif

false_type
__is_destructible_test(__any);

template <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value>
struct __destructible_imp
    : public common_type
        <
            decltype(__is_destructible_test(declval<_Tp>()))
        >::type {};

template <class _Tp>
struct __destructible_imp<_Tp, true>
    : public false_type {};

template <class _Tp>
struct is_destructible
    : public __destructible_imp<_Tp> {};

// move

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename remove_reference<_Tp>::type&&
move(_Tp&& __t) _NOEXCEPT
{
    typedef typename remove_reference<_Tp>::type _Up;
    return static_cast<_Up&&>(__t);
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&&
forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
{
    return static_cast<_Tp&&>(__t);
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&&
forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
{
    static_assert(!std::is_lvalue_reference<_Tp>::value,
                  "Can not forward an rvalue as an lvalue.");
    return static_cast<_Tp&&>(__t);
}

#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
move(_Tp& __t)
{
    return __t;
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
move(const _Tp& __t)
{
    return __t;
}

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
{
    return __t;
}


template <class _Tp>
class __rv
{
    typedef typename remove_reference<_Tp>::type _Trr;
    _Trr& t_;
public:
    _LIBCPP_INLINE_VISIBILITY
    _Trr* operator->() {return &t_;}
    _LIBCPP_INLINE_VISIBILITY
    explicit __rv(_Trr& __t) : t_(__t) {}
};

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct _LIBCPP_VISIBLE decay
{
private:
    typedef typename remove_reference<_Tp>::type _Up;
public:
    typedef typename conditional
                     <
                         is_array<_Up>::value,
                         typename remove_extent<_Up>::type*,
                         typename conditional
                         <
                              is_function<_Up>::value,
                              typename add_pointer<_Up>::type,
                              typename remove_cv<_Up>::type
                         >::type
                     >::type type;
};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename decay<_Tp>::type
__decay_copy(_Tp&& __t)
{
    return _VSTD::forward<_Tp>(__t);
}

#else

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename decay<_Tp>::type
__decay_copy(const _Tp& __t)
{
    return _VSTD::forward<_Tp>(__t);
}

#endif

template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{
};

#ifndef _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

#if __has_feature(cxx_reference_qualified_functions)

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
{
    typedef _Class& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
{
    typedef _Class const& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
{
    typedef _Class volatile& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
{
    typedef _Class const volatile& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
{
    typedef _Class&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
{
    typedef _Class const&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
{
    typedef _Class volatile&& _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
{
    typedef _Class const volatile&& _ClassType;
    typedef _Rp _ReturnType;
};

#endif  // __has_feature(cxx_reference_qualified_functions)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
{
    typedef _Class const _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
{
    typedef _Class volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

template <class _Rp, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
{
    typedef _Class const volatile _ClassType;
    typedef _Rp _ReturnType;
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
{
    typedef _Class _ClassType;
    typedef _Rp _ReturnType;
};

template <class _MP>
struct __member_pointer_traits
    : public __member_pointer_traits_imp<_MP,
                    is_member_function_pointer<_MP>::value,
                    is_member_object_pointer<_MP>::value>
{
//     typedef ... _ClassType;
//     typedef ... _ReturnType;
};

// result_of

template <class _Callable> class result_of;

template <class _Fn, bool, bool>
class __result_of
{
};

#ifndef _LIBCPP_HAS_NO_VARIADICS

template <class _Fn, class ..._ArgTypes>
class __result_of<_Fn(_ArgTypes...), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type;
};

template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
struct __result_of_mp;

// member function pointer

template <class _MP, class _Tp>
struct __result_of_mp<_MP, _Tp, true>
    : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
{
};

// member data pointer

template <class _MP, class _Tp, bool>
struct __result_of_mdp;

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
    typedef typename __apply_cv<_Tp, _Rp>::type&& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mp<_Rp _Class::*, _Tp, false>
    : public __result_of_mdp<_Rp _Class::*, _Tp,
            is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};

template <class _Fn, class _Tp, class ..._ArgTypes>
class __result_of<_Fn(_Tp, _ArgTypes...), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

// result_of

template <class _Fn, class ..._ArgTypes>
class _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)>
    : public __result_of<_Fn(_ArgTypes...),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Fn>
class __result_of<_Fn(), true, false>
{
public:
    typedef decltype(declval<_Fn>()()) type;
};

template <class _Fn, class _A0>
class __result_of<_Fn(_A0), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>())) type;
};

template <class _Fn, class _A0, class _A1>
class __result_of<_Fn(_A0, _A1), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
};

template <class _Fn, class _A0, class _A1, class _A2>
class __result_of<_Fn(_A0, _A1, _A2), true, false>
{
public:
    typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
};

template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
struct __result_of_mp;

// member function pointer

template <class _MP, class _Tp>
struct __result_of_mp<_MP, _Tp, true>
    : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
{
};

// member data pointer

template <class _MP, class _Tp, bool>
struct __result_of_mdp;

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
    typedef typename __apply_cv<_Tp, _Rp>::type& type;
};

template <class _Rp, class _Class, class _Tp>
struct __result_of_mp<_Rp _Class::*, _Tp, false>
    : public __result_of_mdp<_Rp _Class::*, _Tp,
            is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};



template <class _Fn, class _Tp>
class __result_of<_Fn(_Tp), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0>
class __result_of<_Fn(_Tp, _A0), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0, class _A1>
class __result_of<_Fn(_Tp, _A0, _A1), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true>  // _Fn must be member pointer
    : public __result_of_mp<typename remove_reference<_Fn>::type,
                            _Tp,
                            is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
{
};

// result_of

template <class _Fn>
class _LIBCPP_VISIBLE result_of<_Fn()>
    : public __result_of<_Fn(),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0>
class _LIBCPP_VISIBLE result_of<_Fn(_A0)>
    : public __result_of<_Fn(_A0),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0, class _A1>
class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)>
    : public __result_of<_Fn(_A0, _A1),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

template <class _Fn, class _A0, class _A1, class _A2>
class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)>
    : public __result_of<_Fn(_A0, _A1, _A2),
                         is_class<typename remove_reference<_Fn>::type>::value ||
                         is_function<typename remove_reference<_Fn>::type>::value,
                         is_member_pointer<typename remove_reference<_Fn>::type>::value
                        >
{
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

#ifndef _LIBCPP_HAS_NO_VARIADICS

// template <class T, class... Args> struct is_constructible;

//      main is_constructible test

template <class _Tp, class ..._Args>
decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
__is_constructible_test(_Tp&&, _Args&& ...);

template <class ..._Args>
false_type
__is_constructible_test(__any, _Args&& ...);

template <bool, class _Tp, class... _Args>
struct __is_constructible // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
             >::type
    {};

//      function types are not constructible

template <class _Rp, class... _A1, class... _A2>
struct __is_constructible<false, _Rp(_A1...), _A2...>
    : public false_type
    {};

//      handle scalars and reference types

//      Scalars are default constructible, references are not

template <class _Tp>
struct __is_constructible<true, _Tp>
    : public is_scalar<_Tp>
    {};

//      Scalars and references are constructible from one arg if that arg is
//          implicitly convertible to the scalar or reference.

template <class _Tp>
struct __is_constructible_ref
{
    true_type static __(_Tp);
    false_type static __(...);
};

template <class _Tp, class _A0>
struct __is_constructible<true, _Tp, _A0>
    : public common_type
             <
                 decltype(__is_constructible_ref<_Tp>::__(declval<_A0>()))
             >::type
    {};

//      Scalars and references are not constructible from multiple args.

template <class _Tp, class _A0, class ..._Args>
struct __is_constructible<true, _Tp, _A0, _Args...>
    : public false_type
    {};

//      Treat scalars and reference types separately

template <bool, class _Tp, class... _Args>
struct __is_constructible_void_check
    : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _Args...>
    {};

//      If any of T or Args is void, is_constructible should be false

template <class _Tp, class... _Args>
struct __is_constructible_void_check<true, _Tp, _Args...>
    : public false_type
    {};

template <class ..._Args> struct __contains_void;

template <> struct __contains_void<> : false_type {};

template <class _A0, class ..._Args>
struct __contains_void<_A0, _Args...>
{
    static const bool value = is_void<_A0>::value ||
                              __contains_void<_Args...>::value;
};

//      is_constructible entry point

template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_constructible
    : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
                                        || is_abstract<_Tp>::value,
                                           _Tp, _Args...>
    {};

//      Array types are default constructible if their element type
//      is default constructible

template <class _Ap, size_t _Np>
struct __is_constructible<false, _Ap[_Np]>
    : public is_constructible<typename remove_all_extents<_Ap>::type>
    {};

//      Otherwise array types are not constructible by this syntax

template <class _Ap, size_t _Np, class ..._Args>
struct __is_constructible<false, _Ap[_Np], _Args...>
    : public false_type
    {};

//      Incomplete array types are not constructible

template <class _Ap, class ..._Args>
struct __is_constructible<false, _Ap[], _Args...>
    : public false_type
    {};

#else  // _LIBCPP_HAS_NO_VARIADICS

// template <class T> struct is_constructible0;

//      main is_constructible0 test

template <class _Tp>
decltype((_Tp(), true_type()))
__is_constructible0_test(_Tp&);

false_type
__is_constructible0_test(__any);

template <class _Tp, class _A0>
decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
__is_constructible1_test(_Tp&, _A0&);

template <class _A0>
false_type
__is_constructible1_test(__any, _A0&);

template <class _Tp, class _A0, class _A1>
decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
__is_constructible2_test(_Tp&, _A0&, _A1&);

template <class _A0, class _A1>
false_type
__is_constructible2_test(__any, _A0&, _A1&);

template <bool, class _Tp>
struct __is_constructible0_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible0_test(declval<_Tp&>()))
             >::type
    {};

template <bool, class _Tp, class _A0>
struct __is_constructible1_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
             >::type
    {};

template <bool, class _Tp, class _A0, class _A1>
struct __is_constructible2_imp // false, _Tp is not a scalar
    : public common_type
             <
                 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
             >::type
    {};

//      handle scalars and reference types

//      Scalars are default constructible, references are not

template <class _Tp>
struct __is_constructible0_imp<true, _Tp>
    : public is_scalar<_Tp>
    {};

template <class _Tp, class _A0>
struct __is_constructible1_imp<true, _Tp, _A0>
    : public is_convertible<_A0, _Tp>
    {};

template <class _Tp, class _A0, class _A1>
struct __is_constructible2_imp<true, _Tp, _A0, _A1>
    : public false_type
    {};

//      Treat scalars and reference types separately

template <bool, class _Tp>
struct __is_constructible0_void_check
    : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp>
    {};

template <bool, class _Tp, class _A0>
struct __is_constructible1_void_check
    : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _A0>
    {};

template <bool, class _Tp, class _A0, class _A1>
struct __is_constructible2_void_check
    : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                                _Tp, _A0, _A1>
    {};

//      If any of T or Args is void, is_constructible should be false

template <class _Tp>
struct __is_constructible0_void_check<true, _Tp>
    : public false_type
    {};

template <class _Tp, class _A0>
struct __is_constructible1_void_check<true, _Tp, _A0>
    : public false_type
    {};

template <class _Tp, class _A0, class _A1>
struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
    : public false_type
    {};

//      is_constructible entry point

namespace __is_construct
{

struct __nat {};

}

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_VISIBLE is_constructible
    : public __is_constructible2_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value
                                        || is_void<_A0>::value
                                        || is_void<_A1>::value,
                                           _Tp, _A0, _A1>
    {};

template <class _Tp>
struct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
    : public __is_constructible0_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value,
                                           _Tp>
    {};

template <class _Tp, class _A0>
struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat>
    : public __is_constructible1_void_check<is_void<_Tp>::value
                                        || is_abstract<_Tp>::value
                                        || is_function<_Tp>::value
                                        || is_void<_A0>::value,
                                           _Tp, _A0>
    {};

//      Array types are default constructible if their element type
//      is default constructible

template <class _Ap, size_t _Np>
struct __is_constructible0_imp<false, _Ap[_Np]>
    : public is_constructible<typename remove_all_extents<_Ap>::type>
    {};

template <class _Ap, size_t _Np, class _A0>
struct __is_constructible1_imp<false, _Ap[_Np], _A0>
    : public false_type
    {};

template <class _Ap, size_t _Np, class _A0, class _A1>
struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
    : public false_type
    {};

//      Incomplete array types are not constructible

template <class _Ap>
struct __is_constructible0_imp<false, _Ap[]>
    : public false_type
    {};

template <class _Ap, class _A0>
struct __is_constructible1_imp<false, _Ap[], _A0>
    : public false_type
    {};

template <class _Ap, class _A0, class _A1>
struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
    : public false_type
    {};

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_default_constructible

template <class _Tp>
struct _LIBCPP_VISIBLE is_default_constructible
    : public is_constructible<_Tp>
    {};

// is_copy_constructible

template <class _Tp>
struct _LIBCPP_VISIBLE is_copy_constructible
    : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_move_constructible

template <class _Tp>
struct _LIBCPP_VISIBLE is_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_copy_constructible<_Tp>
#endif
    {};

// is_trivially_constructible

#ifndef _LIBCPP_HAS_NO_VARIADICS

#if __has_feature(is_trivially_constructible)

template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_trivially_constructible
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_trivially_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp>
#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
#endif
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

#endif  // !__has_feature(is_trivially_constructible)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_VISIBLE is_trivially_constructible
    : false_type
{
};

#if __has_feature(is_trivially_constructible)

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp)>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
    : integral_constant<bool, is_scalar<_Tp>::value>
{
};

#endif  // !__has_feature(is_trivially_constructible)

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_trivially_default_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_default_constructible
    : public is_trivially_constructible<_Tp>
    {};

// is_trivially_copy_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_constructible
    : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_trivially_move_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_trivially_copy_constructible<_Tp>
#endif
    {};

// is_trivially_assignable

#if __has_feature(is_trivially_constructible)

template <class _Tp, class _Arg>
struct is_trivially_assignable
    : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
{
};

#else  // !__has_feature(is_trivially_constructible)

template <class _Tp, class _Arg>
struct is_trivially_assignable
    : public false_type {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

template <class _Tp>
struct is_trivially_assignable<_Tp&, const _Tp&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&&>
    : integral_constant<bool, is_scalar<_Tp>::value> {};

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#endif  // !__has_feature(is_trivially_constructible)

// is_trivially_copy_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable
    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
                               const typename add_lvalue_reference<_Tp>::type>
    {};

// is_trivially_move_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_assignable
    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                     typename add_rvalue_reference<_Tp>::type>
#else
                                     typename add_lvalue_reference<_Tp>::type>
#endif
    {};

// is_trivially_destructible

#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
    : public integral_constant<bool, __has_trivial_destructor(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct __libcpp_trivial_destructor
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_reference<_Tp>::value> {};

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
    : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// is_nothrow_constructible

#ifndef _LIBCPP_HAS_NO_VARIADICS

#if __has_feature(cxx_noexcept)

template <bool, class _Tp, class... _Args> struct __is_nothrow_constructible;

template <class _Tp, class... _Args>
struct __is_nothrow_constructible<true, _Tp, _Args...>
    : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
{
};

template <class _Tp, class... _Args>
struct __is_nothrow_constructible<false, _Tp, _Args...>
    : public false_type
{
};

template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_nothrow_constructible
    : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
{
};

template <class _Tp, size_t _Ns>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]>
    : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_nothrow_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp>
#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp>
#endif
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

#endif  // __has_feature(cxx_noexcept)

#else  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp, class _A0 = __is_construct::__nat,
                     class _A1 = __is_construct::__nat>
struct _LIBCPP_VISIBLE is_nothrow_constructible
    : false_type
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&,
                                                       __is_construct::__nat>
#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
    : integral_constant<bool, is_scalar<_Tp>::value>
#endif
{
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

// is_nothrow_default_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_default_constructible
    : public is_nothrow_constructible<_Tp>
    {};

// is_nothrow_copy_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_constructible
    : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
    {};

// is_nothrow_move_constructible

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_constructible
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
#else
    : public is_nothrow_copy_constructible<_Tp>
#endif
    {};

// is_nothrow_assignable

#if __has_feature(cxx_noexcept)

template <bool, class _Tp, class _Arg> struct __is_nothrow_assignable;

template <class _Tp, class _Arg>
struct __is_nothrow_assignable<false, _Tp, _Arg>
    : public false_type
{
};

template <class _Tp, class _Arg>
struct __is_nothrow_assignable<true, _Tp, _Arg>
    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
{
};

template <class _Tp, class _Arg>
struct _LIBCPP_VISIBLE is_nothrow_assignable
    : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp, class _Arg>
struct _LIBCPP_VISIBLE is_nothrow_assignable
    : public false_type {};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct is_nothrow_assignable<_Tp&, _Tp&&>
#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
    : integral_constant<bool, is_scalar<_Tp>::value> {};
#endif

#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

#endif  // __has_feature(cxx_noexcept)

// is_nothrow_copy_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_assignable
    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
                               const typename add_lvalue_reference<_Tp>::type>
    {};

// is_nothrow_move_assignable

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_assignable
    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                     typename add_rvalue_reference<_Tp>::type>
#else
                                     typename add_lvalue_reference<_Tp>::type>
#endif
    {};

// is_nothrow_destructible

#if __has_feature(cxx_noexcept)

template <bool, class _Tp> struct __is_nothrow_destructible;

template <class _Tp>
struct __is_nothrow_destructible<false, _Tp>
    : public false_type
{
};

template <class _Tp>
struct __is_nothrow_destructible<true, _Tp>
    : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_destructible
    : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
{
};

template <class _Tp, size_t _Ns>
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]>
    : public is_nothrow_destructible<_Tp>
{
};

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&>
    : public true_type
{
};

#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&>
    : public true_type
{
};

#endif

#else

template <class _Tp> struct __libcpp_nothrow_destructor
    : public integral_constant<bool, is_scalar<_Tp>::value ||
                                     is_reference<_Tp>::value> {};

template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_destructible
    : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};

#endif

// is_pod

#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)

template <class _Tp> struct _LIBCPP_VISIBLE is_pod
    : public integral_constant<bool, __is_pod(_Tp)> {};

#else  // _LIBCPP_HAS_TYPE_TRAITS

template <class _Tp> struct _LIBCPP_VISIBLE is_pod
    : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value   &&
                                     is_trivially_copy_constructible<_Tp>::value      &&
                                     is_trivially_copy_assignable<_Tp>::value    &&
                                     is_trivially_destructible<_Tp>::value> {};

#endif  // _LIBCPP_HAS_TYPE_TRAITS

// is_literal_type;

template <class _Tp> struct _LIBCPP_VISIBLE is_literal_type
#if __has_feature(is_literal)
    : public integral_constant<bool, __is_literal(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
                              is_reference<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_standard_layout;

template <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout
#if __has_feature(is_standard_layout)
    : public integral_constant<bool, __is_standard_layout(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_trivially_copyable;

template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copyable
#if __has_feature(is_trivially_copyable)
    : public integral_constant<bool, __is_trivially_copyable(_Tp)>
#else
    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif
    {};
    
// is_trivial;

template <class _Tp> struct _LIBCPP_VISIBLE is_trivial
#if __has_feature(is_trivial)
    : public integral_constant<bool, __is_trivial(_Tp)>
#else
    : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
                                 is_trivially_default_constructible<_Tp>::value>
#endif
    {};

#ifndef _LIBCPP_HAS_NO_VARIADICS

// Check for complete types

template <class ..._Tp> struct __check_complete;

template <>
struct __check_complete<>
{
};

template <class _Hp, class _T0, class ..._Tp>
struct __check_complete<_Hp, _T0, _Tp...>
    : private __check_complete<_Hp>,
      private __check_complete<_T0, _Tp...>
{
};

template <class _Hp>
struct __check_complete<_Hp, _Hp>
    : private __check_complete<_Hp>
{
};

template <class _Tp>
struct __check_complete<_Tp>
{
    static_assert(sizeof(_Tp) > 0, "Type must be complete.");
};

template <class _Tp>
struct __check_complete<_Tp&>
    : private __check_complete<_Tp>
{
};

template <class _Tp>
struct __check_complete<_Tp&&>
    : private __check_complete<_Tp>
{
};

template <class _Rp, class ..._Param>
struct __check_complete<_Rp (*)(_Param...)>
    : private __check_complete<_Param...>
{
};

template <class _Rp, class ..._Param>
struct __check_complete<_Rp (_Param...)>
    : private __check_complete<_Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...)>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
    : private __check_complete<_Class, _Param...>
{
};

#if __has_feature(cxx_reference_qualified_functions)

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
    : private __check_complete<_Class, _Param...>
{
};

template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
    : private __check_complete<_Class, _Param...>
{
};

#endif

template <class _Rp, class _Class>
struct __check_complete<_Rp _Class::*>
    : private __check_complete<_Class>
{
};

// __invoke forward declarations

// fall back - none of the bullets

template <class ..._Args>
auto
__invoke(__any, _Args&& ...__args)
    -> __nat;

// bullets 1 and 2

template <class _Fp, class _A0, class ..._Args>
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
    -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));

template <class _Fp, class _A0, class ..._Args>
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
    -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));

// bullets 3 and 4

template <class _Fp, class _A0>
auto
__invoke(_Fp&& __f, _A0&& __a0)
    -> decltype(_VSTD::forward<_A0>(__a0).*__f);

template <class _Fp, class _A0>
auto
__invoke(_Fp&& __f, _A0&& __a0)
    -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);

// bullet 5

template <class _Fp, class ..._Args>
auto
__invoke(_Fp&& __f, _Args&& ...__args)
    -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));

// __invokable

template <class _Fp, class ..._Args>
struct __invokable_imp
    : private __check_complete<_Fp, _Args...>
{
    typedef decltype(
            __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
                    ) type;
    static const bool value = !is_same<type, __nat>::value;
};

template <class _Fp, class ..._Args>
struct __invokable
    : public integral_constant<bool,
          __invokable_imp<_Fp, _Args...>::value>
{
};

// __invoke_of

template <bool _Invokable, class _Fp, class ..._Args>
struct __invoke_of_imp  // false
{
};

template <class _Fp, class ..._Args>
struct __invoke_of_imp<true, _Fp, _Args...>
{
    typedef typename __invokable_imp<_Fp, _Args...>::type type;
};

template <class _Fp, class ..._Args>
struct __invoke_of
    : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
{
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
typename enable_if
<
    is_move_constructible<_Tp>::value &&
    is_move_assignable<_Tp>::value
>::type
#else
void
#endif
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
                                    is_nothrow_move_assignable<_Tp>::value)
{
    _Tp __t(_VSTD::move(__x));
    __x = _VSTD::move(__y);
    __y = _VSTD::move(__t);
}

template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
    //                                  _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
               _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
                                          *_VSTD::declval<_ForwardIterator2>())))
{
    swap(*__a, *__b);
}

// __swappable

namespace __detail
{

using _VSTD::swap;
__nat swap(__any, __any);

template <class _Tp>
struct __swappable
{
    typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type;
    static const bool value = !is_same<type, __nat>::value;
};

}  // __detail

template <class _Tp>
struct __is_swappable
    : public integral_constant<bool, __detail::__swappable<_Tp>::value>
{
};

#if __has_feature(cxx_noexcept)

template <bool, class _Tp>
struct __is_nothrow_swappable_imp
    : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(),
                                                   _VSTD::declval<_Tp&>()))>
{
};

template <class _Tp>
struct __is_nothrow_swappable_imp<false, _Tp>
    : public false_type
{
};

template <class _Tp>
struct __is_nothrow_swappable
    : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
{
};

#else  // __has_feature(cxx_noexcept)

template <class _Tp>
struct __is_nothrow_swappable
    : public false_type
{
};

#endif  // __has_feature(cxx_noexcept)

#ifdef _LIBCXX_UNDERLYING_TYPE

template <class _Tp>
struct underlying_type
{
    typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
};

#else  // _LIBCXX_UNDERLYING_TYPE

template <class _Tp, bool _Support = false>
struct underlying_type
{
    static_assert(_Support, "The underyling_type trait requires compiler "
                            "support. Either no such support exists or "
                            "libc++ does not know how to use it.");
};

#endif // _LIBCXX_UNDERLYING_TYPE

_LIBCPP_END_NAMESPACE_STD

#endif  // _LIBCPP_TYPE_TRAITS
@


1.3.2.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 243376
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r243376 | dim | 2012-11-21 18:38:56 +0000 (Wed, 21 Nov 2012) | 14 lines
## SVN ##
## SVN ## MFC r241903:
## SVN ##
## SVN ##   Import libc++ trunk r165949.  Among other improvements and bug fixes,
## SVN ##   this has many visibility problems fixed, which should help with
## SVN ##   compiling certain ports that exercise C++11 mode (i.e. Firefox).
## SVN ##
## SVN ##   Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files,
## SVN ##   which are referred to in all the source files.
## SVN ##
## SVN ## MFC r241907:
## SVN ##
## SVN ##   Fix two -Wsystem-header warnings in libc++ that were exposed by the new
## SVN ##   ATF import.  These have also been sent upstream.
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@a609 14
// is_base_of

#ifdef _LIBCP_HAS_IS_BASE_OF

template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
    : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};

#else  // __has_feature(is_base_of)

#error is_base_of not implemented.

#endif  // __has_feature(is_base_of)

d615 1
a615 2
    : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
                                     !is_abstract<_T2>::value> {};
d621 3
d625 1
a659 1
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
a660 9
#else
        sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
         && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
              && (!is_const<typename remove_reference<_T2>::type>::value
                  || is_volatile<typename remove_reference<_T2>::type>::value)
                  && (is_same<typename remove_cv<_T1>::type,
                              typename remove_cv<typename remove_reference<_T2>::type>::type>::value
                      || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
#endif
a689 1
template <class _T1>            struct __is_convertible<_T1, _T1&, 2, 0>               : public true_type {};
d721 14
a1611 2
#ifdef _LIBCPP_HAS_NO_VARIADICS

d1617 66
d2784 1
a2784 1
    : private __check_complete<_Rp>
d2790 1
a2790 1
    : private __check_complete<_Rp>
d2796 1
a2796 1
    : private __check_complete<_Class>
d2802 1
a2802 1
    : private __check_complete<_Class>
d2808 1
a2808 1
    : private __check_complete<_Class>
d2814 1
a2814 1
    : private __check_complete<_Class>
d2822 1
a2822 1
    : private __check_complete<_Class>
d2828 1
a2828 1
    : private __check_complete<_Class>
d2834 1
a2834 1
    : private __check_complete<_Class>
d2840 1
a2840 1
    : private __check_complete<_Class>
d2846 1
a2846 1
    : private __check_complete<_Class>
d2852 1
a2852 1
    : private __check_complete<_Class>
d2858 1
a2858 1
    : private __check_complete<_Class>
d2864 1
a2864 1
    : private __check_complete<_Class>
a2887 1
_LIBCPP_INLINE_VISIBILITY
a2892 1
_LIBCPP_INLINE_VISIBILITY
a2899 1
_LIBCPP_INLINE_VISIBILITY
a2904 1
_LIBCPP_INLINE_VISIBILITY
a2911 1
_LIBCPP_INLINE_VISIBILITY
d2920 1
a2920 1
    : private __check_complete<_Fp>
a2953 6
template <class _Fp, class ..._Args>
class _LIBCPP_VISIBLE result_of<_Fp(_Args...)>
    : public __invoke_of<_Fp, _Args...>
{
};

@


1.3.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/243683
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r243683 | dim | 2012-11-29 21:26:57 +0000 (Thu, 29 Nov 2012) | 4 lines
## SVN ##
## SVN ## MFC r242945 (by theraven):
## SVN ##
## SVN ##   Import new version of libc++ into base.
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d159 1
a159 1
struct __two {char __lx[2];};
d757 1
a757 1
    double __lx;
d762 1
a762 1
    double __lx;
d814 1
a814 1
template <class _Tp> struct __alignment_of {_Tp __lx;};
d845 2
a846 2
struct __struct_double {long double __lx;};
struct __struct_double4 {double __lx[4];};
d921 1
a921 1
        unsigned char __lx[_Len];\
a1773 2
template<typename, typename T> struct __select_2nd { typedef T type; };

d1775 1
a1775 1
typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type
d1812 2
a1813 2
    true_type static __lxx(_Tp);
    false_type static __lxx(...);
d1820 1
a1820 1
                 decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
@


1.3.2.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250514
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a131 1
    template <size_t Len, class... Types> struct aligned_union;
d152 1
a152 1
    struct _LIBCPP_TYPE_VIS conditional {typedef _If type;};
d154 1
a154 1
    struct _LIBCPP_TYPE_VIS conditional<false, _If, _Then> {typedef _Then type;};
d156 2
a157 2
template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS enable_if {};
template <class _Tp> struct _LIBCPP_TYPE_VIS enable_if<true, _Tp> {typedef _Tp type;};
d164 1
a164 1
struct _LIBCPP_TYPE_VIS integral_constant
d181 2
a182 2
template <class _Tp> struct _LIBCPP_TYPE_VIS is_const            : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_const<_Tp const> : public true_type {};
d186 2
a187 2
template <class _Tp> struct _LIBCPP_TYPE_VIS is_volatile               : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_volatile<_Tp volatile> : public true_type {};
d191 2
a192 2
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_const            {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_const<const _Tp> {typedef _Tp type;};
d196 2
a197 2
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_volatile               {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
d201 1
a201 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_cv
d209 1
a209 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_void
d217 1
a217 1
template <class _Tp> struct _LIBCPP_TYPE_VIS __is_nullptr_t
d241 1
a241 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_integral
d251 1
a251 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_floating_point
d256 1
a256 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_array
d258 1
a258 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_array<_Tp[]>
d260 1
a260 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS is_array<_Tp[_Np]>
d268 1
a268 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_pointer
d273 2
a274 2
template <class _Tp> struct _LIBCPP_TYPE_VIS is_lvalue_reference       : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_lvalue_reference<_Tp&> : public true_type {};
d276 1
a276 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_rvalue_reference        : public false_type {};
d278 1
a278 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
d281 2
a282 2
template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference        : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference<_Tp&>  : public true_type {};
d284 1
a284 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_reference<_Tp&&> : public true_type {};
d295 1
a295 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_union
d301 1
a301 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_union
d310 1
a310 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_class
d321 1
a321 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_class
d328 2
a329 2
template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS is_same           : public false_type {};
template <class _Tp>            struct _LIBCPP_TYPE_VIS is_same<_Tp, _Tp> : public true_type {};
d350 1
a350 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_function
d358 1
a358 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_function_pointer
d366 1
a366 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_pointer
d371 1
a371 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_member_object_pointer
d379 1
a379 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_enum
d384 1
a384 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_enum
d400 1
a400 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_arithmetic
d406 1
a406 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_fundamental
d413 1
a413 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_scalar
d420 1
a420 1
template <> struct _LIBCPP_TYPE_VIS is_scalar<nullptr_t> : public true_type {};
d424 1
a424 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_object
d432 1
a432 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_compound
d445 1
a445 1
template <class _Tp> struct _LIBCPP_TYPE_VIS add_const
d458 1
a458 1
template <class _Tp> struct _LIBCPP_TYPE_VIS add_volatile
d463 1
a463 1
template <class _Tp> struct _LIBCPP_TYPE_VIS add_cv
d468 2
a469 2
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference        {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference<_Tp&>  {typedef _Tp type;};
d471 1
a471 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference<_Tp&&> {typedef _Tp type;};
d476 6
a481 6
template <class _Tp> struct _LIBCPP_TYPE_VIS add_lvalue_reference                      {typedef _Tp& type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS add_lvalue_reference<const volatile void> {typedef const volatile void type;};
d485 5
a489 5
template <class _Tp> struct _LIBCPP_TYPE_VIS  add_rvalue_reference                     {typedef _Tp&& type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS add_rvalue_reference<const volatile void> {typedef const volatile void type;};
d514 5
a518 5
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer                      {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp*>                {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* const>          {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* volatile>       {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* const volatile> {typedef _Tp type;};
d522 1
a522 1
template <class _Tp> struct _LIBCPP_TYPE_VIS add_pointer
d538 1
a538 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_signed : public __is_signed<_Tp> {};
d553 1
a553 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_unsigned : public __is_unsigned<_Tp> {};
d557 1
a557 1
template <class _Tp> struct _LIBCPP_TYPE_VIS rank
d559 1
a559 1
template <class _Tp> struct _LIBCPP_TYPE_VIS rank<_Tp[]>
d561 1
a561 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS rank<_Tp[_Np]>
d566 1
a566 1
template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS extent
d568 1
a568 1
template <class _Tp> struct _LIBCPP_TYPE_VIS extent<_Tp[], 0>
d570 1
a570 1
template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS extent<_Tp[], _Ip>
d572 1
a572 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS extent<_Tp[_Np], 0>
d574 1
a574 1
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS extent<_Tp[_Np], _Ip>
d579 1
a579 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_extent
d581 1
a581 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_extent<_Tp[]>
d583 1
a583 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS remove_extent<_Tp[_Np]>
d588 1
a588 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_all_extents
d590 1
a590 1
template <class _Tp> struct _LIBCPP_TYPE_VIS remove_all_extents<_Tp[]>
d592 1
a592 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS remove_all_extents<_Tp[_Np]>
d608 1
a608 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_abstract : public __libcpp_abstract<_Tp> {};
d615 1
a615 1
struct _LIBCPP_TYPE_VIS is_base_of
d620 1
a620 22
namespace __is_base_of_imp
{
template <class _Tp>
struct _Dst
{
    _Dst(const volatile _Tp &);
};
template <class _Tp>
struct _Src
{
    operator const volatile _Tp &();
    template <class _Up> operator const _Dst<_Up> &();
};
template <size_t> struct __one { typedef char type; };
template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
template <class _Bp, class _Dp> __two __test(...);
}

template <class _Bp, class _Dp>
struct _LIBCPP_TYPE_VIS is_base_of
    : public integral_constant<bool, is_class<_Bp>::value &&
                                     sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};
d628 1
a628 1
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS is_convertible
d734 1
a734 1
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS is_convertible
d748 1
a748 1
struct _LIBCPP_TYPE_VIS is_empty
d770 1
a770 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_empty : public __libcpp_empty<_Tp> {};
d779 1
a779 1
struct _LIBCPP_TYPE_VIS is_polymorphic
d784 6
a789 4
template<typename _Tp> char &__is_polymorphic_impl(
    typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
                       int>::type);
template<typename _Tp> __two &__is_polymorphic_impl(...);
d791 4
a794 2
template <class _Tp> struct _LIBCPP_TYPE_VIS is_polymorphic
    : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};
d802 1
a802 1
template <class _Tp> struct _LIBCPP_TYPE_VIS has_virtual_destructor
d807 1
a807 1
template <class _Tp> struct _LIBCPP_TYPE_VIS has_virtual_destructor
d814 4
a817 2
template <class _Tp> struct _LIBCPP_TYPE_VIS alignment_of
    : public integral_constant<size_t, __alignof__(_Tp)> {};
d904 1
a904 1
struct _LIBCPP_TYPE_VIS aligned_storage
d917 1
a917 1
struct _LIBCPP_TYPE_VIS aligned_storage<_Len, n>\
a945 32
#ifndef _LIBCPP_HAS_NO_VARIADICS

// aligned_union

template <size_t _I0, size_t ..._In>
struct __static_max;

template <size_t _I0>
struct __static_max<_I0>
{
    static const size_t value = _I0;
};

template <size_t _I0, size_t _I1, size_t ..._In>
struct __static_max<_I0, _I1, _In...>
{
    static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value :
                                             __static_max<_I1, _In...>::value;
};

template <size_t _Len, class _Type0, class ..._Types>
struct aligned_union
{
    static const size_t alignment_value = __static_max<__alignof__(_Type0),
                                                       __alignof__(_Types)...>::value;
    static const size_t __len = __static_max<_Len, sizeof(_Type0),
                                             sizeof(_Types)...>::value;
    typedef typename aligned_storage<__len, alignment_value>::type type;
};

#endif  // _LIBCPP_HAS_NO_VARIADICS

d1100 1
a1100 1
struct _LIBCPP_TYPE_VIS make_signed
d1125 1
a1125 1
struct _LIBCPP_TYPE_VIS make_unsigned
d1133 1
a1133 1
struct _LIBCPP_TYPE_VIS common_type
d1140 1
a1140 1
struct _LIBCPP_TYPE_VIS common_type<_Tp, void, void>
d1147 1
a1147 1
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up, void>
d1166 1
a1166 1
struct _LIBCPP_TYPE_VIS common_type<_Tp>
d1172 1
a1172 1
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up>
d1183 1
a1183 1
struct _LIBCPP_TYPE_VIS common_type<_Tp, _Up, _Vp...>
d1227 1
a1227 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_copy_assignable
d1233 1
a1233 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_move_assignable
d1348 1
a1348 1
struct _LIBCPP_TYPE_VIS decay
d1727 1
a1727 1
class _LIBCPP_TYPE_VIS result_of<_Fn()>
d1737 1
a1737 1
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0)>
d1747 1
a1747 1
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0, _A1)>
d1757 1
a1757 1
class _LIBCPP_TYPE_VIS result_of<_Fn(_A0, _A1, _A2)>
d1862 1
a1862 1
struct _LIBCPP_TYPE_VIS is_constructible
d2010 1
a2010 1
struct _LIBCPP_TYPE_VIS is_constructible
d2020 1
a2020 1
struct _LIBCPP_TYPE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
d2028 1
a2028 1
struct _LIBCPP_TYPE_VIS is_constructible<_Tp, _A0, __is_construct::__nat>
d2076 1
a2076 1
struct _LIBCPP_TYPE_VIS is_default_constructible
d2083 1
a2083 1
struct _LIBCPP_TYPE_VIS is_copy_constructible
d2090 1
a2090 1
struct _LIBCPP_TYPE_VIS is_move_constructible
d2105 1
a2105 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible
d2113 1
a2113 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible
d2119 1
a2119 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp>
d2130 1
a2130 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&&>
d2132 1
a2132 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp>
d2139 1
a2139 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&>
d2145 1
a2145 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&>
d2156 1
a2156 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible
d2164 1
a2164 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
d2171 1
a2171 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp,
d2178 1
a2178 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&,
d2185 1
a2185 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&,
d2194 1
a2194 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
d2201 1
a2201 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp,
d2208 1
a2208 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, const _Tp&,
d2215 1
a2215 1
struct _LIBCPP_TYPE_VIS is_trivially_constructible<_Tp, _Tp&,
d2227 1
a2227 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_default_constructible
d2233 1
a2233 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copy_constructible
d2239 1
a2239 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_move_constructible
d2287 1
a2287 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copy_assignable
d2294 1
a2294 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_move_assignable
d2307 1
a2307 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_destructible
d2316 1
a2316 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_destructible
d2342 1
a2342 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
d2348 1
a2348 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp[_Ns]>
d2356 1
a2356 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
d2362 1
a2362 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp>
d2373 1
a2373 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&&>
d2375 1
a2375 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp>
d2386 1
a2386 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, const _Tp&>
d2396 1
a2396 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&>
d2411 1
a2411 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible
d2417 1
a2417 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat,
d2428 1
a2428 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp,
d2439 1
a2439 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, const _Tp&,
d2450 1
a2450 1
struct _LIBCPP_TYPE_VIS is_nothrow_constructible<_Tp, _Tp&,
d2464 1
a2464 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_default_constructible
d2470 1
a2470 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_copy_constructible
d2476 1
a2476 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_move_constructible
d2503 1
a2503 1
struct _LIBCPP_TYPE_VIS is_nothrow_assignable
d2511 1
a2511 1
struct _LIBCPP_TYPE_VIS is_nothrow_assignable
d2515 1
a2515 1
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, _Tp>
d2523 1
a2523 1
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, _Tp&>
d2531 1
a2531 1
struct _LIBCPP_TYPE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
d2554 1
a2554 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_copy_assignable
d2561 1
a2561 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_move_assignable
d2589 1
a2589 1
struct _LIBCPP_TYPE_VIS is_nothrow_destructible
d2595 1
a2595 1
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp[_Ns]>
d2601 1
a2601 1
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp&>
d2609 1
a2609 1
struct _LIBCPP_TYPE_VIS is_nothrow_destructible<_Tp&&>
d2622 1
a2622 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_nothrow_destructible
d2631 1
a2631 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_pod
d2636 1
a2636 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_pod
d2646 1
a2646 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_literal_type
d2657 1
a2657 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_standard_layout
d2667 1
a2667 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivially_copyable
d2677 1
a2677 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_trivial
d2906 1
a2906 1
class _LIBCPP_TYPE_VIS result_of<_Fp(_Args...)>
@


1.3.2.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/253222
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a139 58
    // const-volatile modifications:
    template <class T>
      using remove_const_t    = typename remove_const<T>::type;  // C++14
    template <class T>
      using remove_volatile_t = typename remove_volatile<T>::type;  // C++14
    template <class T>
      using remove_cv_t       = typename remove_cv<T>::type;  // C++14
    template <class T>
      using add_const_t       = typename add_const<T>::type;  // C++14
    template <class T>
      using add_volatile_t    = typename add_volatile<T>::type;  // C++14
    template <class T>
      using add_cv_t          = typename add_cv<T>::type;  // C++14
  
    // reference modifications:
    template <class T>
      using remove_reference_t     = typename remove_reference<T>::type;  // C++14
    template <class T>
      using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;  // C++14
    template <class T>
      using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;  // C++14
  
    // sign modifications:
    template <class T>
      using make_signed_t   = typename make_signed<T>::type;  // C++14
    template <class T>
      using make_unsigned_t = typename make_unsigned<T>::type;  // C++14
  
    // array modifications:
    template <class T>
      using remove_extent_t      = typename remove_extent<T>::type;  // C++14
    template <class T>
      using remove_all_extents_t = typename remove_all_extents<T>::type;  // C++14

    // pointer modifications:
    template <class T>
      using remove_pointer_t = typename remove_pointer<T>::type;  // C++14
    template <class T>
      using add_pointer_t    = typename add_pointer<T>::type;  // C++14

    // other transformations:
    template <size_t Len, std::size_t Align=default-alignment>
      using aligned_storage_t = typename aligned_storage<Len,Align>::type;  // C++14
    template <std::size_t Len, class... Types>
      using aligned_union_t   = typename aligned_union<Len,Types...>::type;  // C++14
    template <class T>
      using decay_t           = typename decay<T>::type;  // C++14
    template <bool b, class T=void>
      using enable_if_t       = typename enable_if<b,T>::type;  // C++14
    template <bool b, class T, class F>
      using conditional_t     = typename conditional<b,T,F>::type;  // C++14
    template <class... T>
      using common_type_t     = typename common_type<T...>::type;  // C++14
    template <class T>
      using underlying_type_t = typename underlying_type<T>::type;  // C++14
    template <class F, class... ArgTypes>
      using result_of_t       = typename result_of<F(ArgTypes...)>::type;  // C++14

a156 4
#if _LIBCPP_STD_VER > 11
template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
#endif

a159 5
#if _LIBCPP_STD_VER > 11
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
#endif


a193 3
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
#endif
a198 3
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
#endif
a203 3
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
#endif
a448 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
#endif

a461 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
#endif

a466 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
#endif

a474 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
#endif

a483 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
#endif

a491 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
#endif

a520 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
#endif

a525 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
#endif

a586 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
#endif

a595 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
#endif

d919 1
a919 1
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
a930 5
#if _LIBCPP_STD_VER > 11
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
    using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
#endif

a991 4
#if _LIBCPP_STD_VER > 11
template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
#endif

a1152 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type;
#endif

a1177 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
#endif

a1235 4
#if _LIBCPP_STD_VER > 11
template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
#endif

a1413 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using decay_t = typename decay<_Tp>::type;
#endif

d1656 1
a1656 1
    : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
d2881 1
a2881 8
template <class _Fp, class _A0, class ..._Args,
            class = typename enable_if
            <
                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
                is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
d2887 1
a2887 8
template <class _Fp, class _A0, class ..._Args,
            class = typename enable_if
            <
                is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
                !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
d2895 1
a2895 8
template <class _Fp, class _A0,
            class = typename enable_if
            <
                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
                is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
d2901 1
a2901 8
template <class _Fp, class _A0,
            class = typename enable_if
            <
                is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
                !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
                           typename remove_reference<_A0>::type>::value
            >::type
         >
a2958 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
#endif

a3052 4
#if _LIBCPP_STD_VER > 11
template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
#endif

@


1.3.2.7
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/260263
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d283 2
a284 2
template <class _Tp> struct __libcpp_is_void       : public false_type {};
template <>          struct __libcpp_is_void<void> : public true_type {};
d287 1
a287 1
    : public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
d291 2
a292 2
template <class _Tp> struct __libcpp___is_nullptr       : public false_type {};
template <>          struct __libcpp___is_nullptr<nullptr_t> : public true_type {};
d295 1
a295 1
    : public __libcpp___is_nullptr<typename remove_cv<_Tp>::type> {};
d299 6
a304 6
template <class _Tp> struct __libcpp_is_integral                     : public false_type {};
template <>          struct __libcpp_is_integral<bool>               : public true_type {};
template <>          struct __libcpp_is_integral<char>               : public true_type {};
template <>          struct __libcpp_is_integral<signed char>        : public true_type {};
template <>          struct __libcpp_is_integral<unsigned char>      : public true_type {};
template <>          struct __libcpp_is_integral<wchar_t>            : public true_type {};
d306 2
a307 2
template <>          struct __libcpp_is_integral<char16_t>           : public true_type {};
template <>          struct __libcpp_is_integral<char32_t>           : public true_type {};
d309 8
a316 8
template <>          struct __libcpp_is_integral<short>              : public true_type {};
template <>          struct __libcpp_is_integral<unsigned short>     : public true_type {};
template <>          struct __libcpp_is_integral<int>                : public true_type {};
template <>          struct __libcpp_is_integral<unsigned int>       : public true_type {};
template <>          struct __libcpp_is_integral<long>               : public true_type {};
template <>          struct __libcpp_is_integral<unsigned long>      : public true_type {};
template <>          struct __libcpp_is_integral<long long>          : public true_type {};
template <>          struct __libcpp_is_integral<unsigned long long> : public true_type {};
d319 1
a319 1
    : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
d323 4
a326 4
template <class _Tp> struct __libcpp_is_floating_point              : public false_type {};
template <>          struct __libcpp_is_floating_point<float>       : public true_type {};
template <>          struct __libcpp_is_floating_point<double>      : public true_type {};
template <>          struct __libcpp_is_floating_point<long double> : public true_type {};
d329 1
a329 1
    : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
d342 2
a343 2
template <class _Tp> struct __libcpp_is_pointer       : public false_type {};
template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
d346 1
a346 1
    : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
d422 1
a422 1
struct __libcpp_is_function
d425 1
a425 1
template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
d428 1
a428 1
    : public __libcpp_is_function<_Tp> {};
d432 2
a433 2
template <class _Tp> struct            __libcpp_is_member_function_pointer             : public false_type {};
template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
d436 1
a436 1
    : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {};
d440 2
a441 2
template <class _Tp>            struct __libcpp_is_member_pointer             : public false_type {};
template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {};
d444 1
a444 1
    : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
d643 1
a643 1
struct __libcpp_is_signed : public ___is_signed<_Tp> {};
d645 1
a645 1
template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {};
d647 1
a647 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_signed : public __libcpp_is_signed<_Tp> {};
d658 1
a658 1
struct __libcpp_is_unsigned : public ___is_unsigned<_Tp> {};
d660 1
a660 1
template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
d662 1
a662 1
template <class _Tp> struct _LIBCPP_TYPE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {};
@


1.3.2.8
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/262801
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a30 1
    template <class T> struct is_null_pointer;  // C++14
d211 1
a211 1
    struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
d213 1
a213 1
    struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;};
d219 2
a220 2
template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
d232 1
a232 1
struct _LIBCPP_TYPE_VIS_ONLY integral_constant
a238 4
#if _LIBCPP_STD_VER > 11
    _LIBCPP_INLINE_VISIBILITY
         constexpr value_type operator ()() const {return value;}
#endif
d249 2
a250 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const            : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {};
d254 2
a255 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile               : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {};
d259 2
a260 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const            {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;};
d267 2
a268 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile               {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;};
d275 1
a275 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv
d286 1
a286 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
d294 1
a294 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
a296 5
#if _LIBCPP_STD_VER > 11
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
    : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
#endif

d318 1
a318 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
d328 1
a328 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
d333 1
a333 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array
d335 1
a335 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]>
d337 1
a337 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
d345 1
a345 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
d350 2
a351 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference       : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {};
d353 1
a353 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference        : public false_type {};
d355 1
a355 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {};
d358 2
a359 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference        : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&>  : public true_type {};
d361 1
a361 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {};
d372 1
a372 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
d378 1
a378 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
d387 1
a387 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
d398 1
a398 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
d405 2
a406 2
template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same           : public false_type {};
template <class _Tp>            struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {};
d421 1
a421 1
                            __is_nullptr_t<_Tp>::value >
d427 1
a427 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
d435 1
a435 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
d443 1
a443 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
d448 1
a448 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer
d456 1
a456 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
d461 1
a461 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
d477 1
a477 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic
d483 1
a483 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
d490 1
a490 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
d497 1
a497 1
template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {};
d501 1
a501 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
d509 1
a509 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound
d522 1
a522 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const
d539 1
a539 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile
d548 1
a548 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv
d557 2
a558 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference        {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&>  {typedef _Tp type;};
d560 1
a560 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;};
d569 6
a574 6
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference                      {typedef _Tp& type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&>                {typedef _Tp& type;};  // for older compiler
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;};
d582 5
a586 5
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY  add_rvalue_reference                     {typedef _Tp&& type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void>                {typedef void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void>          {typedef const void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void>       {typedef volatile void type;};
template <>          struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;};
d615 5
a619 5
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer                      {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*>                {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const>          {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile>       {typedef _Tp type;};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;};
d627 1
a627 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer
d647 1
a647 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
d662 1
a662 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
d666 1
a666 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank
d668 1
a668 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]>
d670 1
a670 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]>
d675 1
a675 1
template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent
d677 1
a677 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0>
d679 1
a679 1
template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip>
d681 1
a681 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0>
d683 1
a683 1
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip>
d688 1
a688 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent
d690 1
a690 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]>
d692 1
a692 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]>
d701 1
a701 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents
d703 1
a703 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]>
d705 1
a705 1
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]>
a711 25
// decay

template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY decay
{
private:
    typedef typename remove_reference<_Tp>::type _Up;
public:
    typedef typename conditional
                     <
                         is_array<_Up>::value,
                         typename remove_extent<_Up>::type*,
                         typename conditional
                         <
                              is_function<_Up>::value,
                              typename add_pointer<_Up>::type,
                              typename remove_cv<_Up>::type
                         >::type
                     >::type type;
};

#if _LIBCPP_STD_VER > 11
template <class _Tp> using decay_t = typename decay<_Tp>::type;
#endif

d725 1
a725 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
d729 1
a729 1
#ifdef _LIBCPP_HAS_IS_BASE_OF
d732 1
a732 1
struct _LIBCPP_TYPE_VIS_ONLY is_base_of
d756 1
a756 1
struct _LIBCPP_TYPE_VIS_ONLY is_base_of
d766 1
a766 1
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
d872 1
a872 1
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
d886 1
a886 1
struct _LIBCPP_TYPE_VIS_ONLY is_empty
d908 1
a908 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {};
d917 1
a917 1
struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
d927 1
a927 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
d936 1
a936 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
d941 1
a941 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
d948 1
a948 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of
d1036 1
a1036 1
struct _LIBCPP_TYPE_VIS_ONLY aligned_storage
d1054 1
a1054 1
struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\
d1077 1
a1077 1
#if !defined(_LIBCPP_MSVC)
d1079 1
a1079 1
#endif // !_LIBCPP_MSVC
d1273 1
a1273 1
struct _LIBCPP_TYPE_VIS_ONLY make_signed
d1302 1
a1302 1
struct _LIBCPP_TYPE_VIS_ONLY make_unsigned
d1314 1
a1314 1
struct _LIBCPP_TYPE_VIS_ONLY common_type
d1321 1
a1321 1
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void>
d1328 1
a1328 1
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void>
d1347 1
a1347 1
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp>
d1349 1
a1349 1
    typedef typename decay<_Tp>::type type;
d1353 1
a1353 1
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up>
d1360 1
a1360 1
    typedef typename decay<decltype(__f() ? __t() : __u())>::type type;
d1364 1
a1364 1
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
a1376 2
template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; };

d1378 1
a1378 1
typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type
d1412 1
a1412 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
d1418 1
a1418 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable
d1445 1
a1445 2
template <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value
                                                || is_function<_Tp>::value>
a1459 4
template <class _Tp>
struct is_destructible<_Tp[]>
    : public false_type {};

d1465 1
a1465 1
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
d1474 1
a1474 1
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
d1482 1
a1482 1
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
d1532 23
d1916 1
a1916 1
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()>
d1926 1
a1926 1
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)>
d1936 1
a1936 1
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)>
d1946 1
a1946 1
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)>
d1963 2
d2051 1
a2051 1
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
d2199 1
a2199 1
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
d2209 1
a2209 1
struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
d2217 1
a2217 1
struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat>
d2265 1
a2265 1
struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible
d2272 1
a2272 1
struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
d2279 1
a2279 1
struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
d2294 1
a2294 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
d2302 1
a2302 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
d2308 1
a2308 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp>
d2319 1
a2319 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&>
d2321 1
a2321 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp>
d2328 1
a2328 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&>
d2334 1
a2334 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&>
d2345 1
a2345 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
d2353 1
a2353 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
d2360 1
a2360 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
d2367 1
a2367 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
d2374 1
a2374 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
d2383 1
a2383 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
d2390 1
a2390 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
d2397 1
a2397 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
d2404 1
a2404 1
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
d2416 1
a2416 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible
d2422 2
a2423 2
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible
    : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
d2428 1
a2428 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible
d2476 1
a2476 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
d2483 1
a2483 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
d2496 1
a2496 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
d2505 1
a2505 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
d2531 1
a2531 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
d2537 1
a2537 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
d2545 1
a2545 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
d2551 1
a2551 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp>
d2562 1
a2562 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&>
d2564 1
a2564 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp>
d2575 1
a2575 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&>
d2585 1
a2585 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&>
d2600 1
a2600 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
d2606 1
a2606 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat,
d2617 1
a2617 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp,
d2628 1
a2628 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&,
d2639 1
a2639 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&,
d2653 1
a2653 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible
d2659 1
a2659 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
d2665 1
a2665 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
d2692 1
a2692 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
d2700 1
a2700 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
d2704 1
a2704 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp>
d2712 1
a2712 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&>
d2720 1
a2720 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&>
d2743 1
a2743 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
d2750 1
a2750 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
d2778 1
a2778 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
d2784 1
a2784 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]>
d2790 1
a2790 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&>
d2798 1
a2798 1
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&>
d2811 1
a2811 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
d2820 1
a2820 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
d2825 1
a2825 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
d2835 1
a2835 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
d2846 1
a2846 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
d2856 1
a2856 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
d2866 1
a2866 1
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
a2922 5
template <class ..._Param>
struct __check_complete<void (*)(_Param...)>
{
};

a2928 5
template <class ..._Param>
struct __check_complete<void (_Param...)>
{
};

d3123 1
a3123 1
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)>
a3241 21
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE

template <class _Tp>
struct __has_operator_addressof_imp
{
    template <class>
        static auto __test(__any) -> false_type;
    template <class _Up>
        static auto __test(_Up* __u)
            -> typename __select_2nd<decltype(__u->operator&()), true_type>::type;

    static const bool value = decltype(__test<_Tp>(nullptr))::value;
};

template <class _Tp>
struct __has_operator_addressof
    : public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value>
{};

#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE

@


1.2
log
@SVN rev 232950 on 2012-03-14 00:09:36Z by theraven

Import new versions of libcxxrt and libc++.
Please tests any C++ code you care about with -stdlib=libc++!

Approved by:	dim (mentor)
@
text
@d166 1
a166 1
    static constexpr _Tp      value = __v;
d170 1
a170 8
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
    constexpr
#endif
         operator value_type()
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
                               const
#endif
                                     {return value;}
d174 1
a174 1
constexpr _Tp integral_constant<_Tp, __v>::value;
a1300 12
class __rv
{
    typedef typename remove_reference<_Tp>::type _Trr;
    _Trr& t_;
public:
    _LIBCPP_INLINE_VISIBILITY
    _Trr* operator->() {return &t_;}
    _LIBCPP_INLINE_VISIBILITY
    explicit __rv(_Trr& __t) : t_(__t) {}
};

template <class _Tp>
d1302 1
a1302 5
typename enable_if
<
    !is_convertible<_Tp, __rv<_Tp> >::value,
    _Tp&
>::type
d1310 1
a1310 5
typename enable_if
<
    !is_convertible<_Tp, __rv<_Tp> >::value,
    const _Tp&
>::type
d1318 2
a1319 18
typename enable_if
<
    is_convertible<_Tp, __rv<_Tp> >::value,
    _Tp
>::type
move(_Tp& __t)
{
    return _Tp(__rv<_Tp>(__t));
}

template <class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
    !is_convertible<_Tp, __rv<_Tp> >::value,
    typename add_lvalue_reference<_Tp>::type
>::type
forward(_Up& __t)
a1323 11
template <class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
    !is_convertible<_Tp, __rv<_Tp> >::value,
    typename add_lvalue_reference<_Tp>::type
>::type
forward(const _Up& __t)
{
    return __t;
}
d1325 2
a1326 8
template <class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
    is_convertible<_Tp, __rv<_Tp> >::value,
    _Tp
>::type
forward(_Up& __t)
d1328 8
a1335 14
    return _Tp(__rv<_Tp>(__t));
}

template <class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
    is_convertible<_Tp, __rv<_Tp> >::value,
    _Tp
>::type
forward(const _Up& __t)
{
    return _Tp(__rv<_Tp>(__t));
}
@


1.1
log
@SVN rev 227983 on 2011-11-25 20:59:04Z by theraven

Import libc++ / libcxxrt into base.  Not build by default yet (use
MK_LIBCPLUSPLUS=yes to enable).  This is a work-in-progress.  It works for
me, but is not guaranteed to work for anyone else and may eat your dog.

To build C++ using libc++, add -stdlib=libc++ to your CXX and LD flags.

Bug reports welcome, bug fixes even more welcome...

Approved by:	dim (mentor)
@
text
@d151 1
a151 1
template <bool _B, class _If, class _Then>
d744 8
d771 2
d775 8
d795 2
d1157 1
a1157 1
    typedef decltype(true ? __t() : __u()) type;
d1178 1
a1178 1
    typedef decltype(__f() ? __t() : __u()) type;
d1335 12
d1453 2
a1454 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...), true, false>
d1457 1
a1457 1
    typedef _R _ReturnType;
d1460 2
a1461 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const, true, false>
d1464 1
a1464 1
    typedef _R _ReturnType;
d1467 2
a1468 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile, true, false>
d1471 1
a1471 1
    typedef _R _ReturnType;
d1474 2
a1475 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile, true, false>
d1478 1
a1478 1
    typedef _R _ReturnType;
d1483 2
a1484 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &, true, false>
d1487 1
a1487 1
    typedef _R _ReturnType;
d1490 2
a1491 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&, true, false>
d1494 1
a1494 1
    typedef _R _ReturnType;
d1497 2
a1498 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&, true, false>
d1501 1
a1501 1
    typedef _R _ReturnType;
d1504 2
a1505 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&, true, false>
d1508 1
a1508 1
    typedef _R _ReturnType;
d1511 2
a1512 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &&, true, false>
d1515 1
a1515 1
    typedef _R _ReturnType;
d1518 2
a1519 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&&, true, false>
d1522 1
a1522 1
    typedef _R _ReturnType;
d1525 2
a1526 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&&, true, false>
d1529 1
a1529 1
    typedef _R _ReturnType;
d1532 2
a1533 2
template <class _R, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&&, true, false>
d1536 1
a1536 1
    typedef _R _ReturnType;
d1543 2
a1544 2
template <class _R, class _Class>
struct __member_pointer_traits_imp<_R (_Class::*)(), true, false>
d1547 1
a1547 1
    typedef _R _ReturnType;
d1550 2
a1551 2
template <class _R, class _Class, class _P0>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0), true, false>
d1554 1
a1554 1
    typedef _R _ReturnType;
d1557 2
a1558 2
template <class _R, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1), true, false>
d1561 1
a1561 1
    typedef _R _ReturnType;
d1564 2
a1565 2
template <class _R, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2), true, false>
d1568 1
a1568 1
    typedef _R _ReturnType;
d1571 2
a1572 2
template <class _R, class _Class>
struct __member_pointer_traits_imp<_R (_Class::*)() const, true, false>
d1575 1
a1575 1
    typedef _R _ReturnType;
d1578 2
a1579 2
template <class _R, class _Class, class _P0>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const, true, false>
d1582 1
a1582 1
    typedef _R _ReturnType;
d1585 2
a1586 2
template <class _R, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const, true, false>
d1589 1
a1589 1
    typedef _R _ReturnType;
d1592 2
a1593 2
template <class _R, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const, true, false>
d1596 1
a1596 1
    typedef _R _ReturnType;
d1599 2
a1600 2
template <class _R, class _Class>
struct __member_pointer_traits_imp<_R (_Class::*)() volatile, true, false>
d1603 1
a1603 1
    typedef _R _ReturnType;
d1606 2
a1607 2
template <class _R, class _Class, class _P0>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0) volatile, true, false>
d1610 1
a1610 1
    typedef _R _ReturnType;
d1613 2
a1614 2
template <class _R, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) volatile, true, false>
d1617 1
a1617 1
    typedef _R _ReturnType;
d1620 2
a1621 2
template <class _R, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) volatile, true, false>
d1624 1
a1624 1
    typedef _R _ReturnType;
d1627 2
a1628 2
template <class _R, class _Class>
struct __member_pointer_traits_imp<_R (_Class::*)() const volatile, true, false>
d1631 1
a1631 1
    typedef _R _ReturnType;
d1634 2
a1635 2
template <class _R, class _Class, class _P0>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const volatile, true, false>
d1638 1
a1638 1
    typedef _R _ReturnType;
d1641 2
a1642 2
template <class _R, class _Class, class _P0, class _P1>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const volatile, true, false>
d1645 1
a1645 1
    typedef _R _ReturnType;
d1648 2
a1649 2
template <class _R, class _Class, class _P0, class _P1, class _P2>
struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
d1652 1
a1652 1
    typedef _R _ReturnType;
d1657 2
a1658 2
template <class _R, class _Class>
struct __member_pointer_traits_imp<_R _Class::*, false, true>
d1661 1
a1661 1
    typedef _R _ReturnType;
d1708 2
a1709 2
template <class _R, class _Class, class _Tp>
struct __result_of_mdp<_R _Class::*, _Tp, false>
d1711 1
a1711 1
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _R>::type&& type;
d1714 2
a1715 2
template <class _R, class _Class, class _Tp>
struct __result_of_mdp<_R _Class::*, _Tp, true>
d1717 1
a1717 1
    typedef typename __apply_cv<_Tp, _R>::type&& type;
d1720 3
a1722 3
template <class _R, class _Class, class _Tp>
struct __result_of_mp<_R _Class::*, _Tp, false>
    : public __result_of_mdp<_R _Class::*, _Tp,
d1793 2
a1794 2
template <class _R, class _Class, class _Tp>
struct __result_of_mdp<_R _Class::*, _Tp, false>
d1796 1
a1796 1
    typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _R>::type& type;
d1799 2
a1800 2
template <class _R, class _Class, class _Tp>
struct __result_of_mdp<_R _Class::*, _Tp, true>
d1802 1
a1802 1
    typedef typename __apply_cv<_Tp, _R>::type& type;
d1805 3
a1807 3
template <class _R, class _Class, class _Tp>
struct __result_of_mp<_R _Class::*, _Tp, false>
    : public __result_of_mdp<_R _Class::*, _Tp,
d1914 2
a1915 2
template <class _R, class... _A1, class... _A2>
struct __is_constructible<false, _R(_A1...), _A2...>
d1991 3
a1993 3
template <class _A, size_t _N>
struct __is_constructible<false, _A[_N]>
    : public is_constructible<typename remove_all_extents<_A>::type>
d1998 2
a1999 2
template <class _A, size_t _N, class ..._Args>
struct __is_constructible<false, _A[_N], _Args...>
d2005 2
a2006 2
template <class _A, class ..._Args>
struct __is_constructible<false, _A[], _Args...>
d2159 3
a2161 3
template <class _A, size_t _N>
struct __is_constructible0_imp<false, _A[_N]>
    : public is_constructible<typename remove_all_extents<_A>::type>
d2164 2
a2165 2
template <class _A, size_t _N, class _A0>
struct __is_constructible1_imp<false, _A[_N], _A0>
d2169 2
a2170 2
template <class _A, size_t _N, class _A0, class _A1>
struct __is_constructible2_imp<false, _A[_N], _A0, _A1>
d2176 2
a2177 2
template <class _A>
struct __is_constructible0_imp<false, _A[]>
d2181 2
a2182 2
template <class _A, class _A0>
struct __is_constructible1_imp<false, _A[], _A0>
d2186 2
a2187 2
template <class _A, class _A0, class _A1>
struct __is_constructible2_imp<false, _A[], _A0, _A1>
d2222 10
a2253 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2254 1
#endif
a2259 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2260 1
#endif
a2265 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2266 1
#endif
d2270 2
d2281 32
a2315 3
#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
a2316 1
#endif
a2322 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2323 1
#endif
a2329 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2330 1
#endif
a2336 3
#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_copy(_Tp)>
#else
a2337 1
#endif
d2341 2
d2369 10
a2384 3
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
a2385 1
#endif
a2388 3
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
a2389 1
#endif
a2392 3
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
a2393 1
#endif
a2398 3
#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
    : integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
a2399 1
#endif
d2403 2
d2810 1
a2810 1
template <class ..._T> struct __check_complete;
d2817 4
a2820 4
template <class _H, class _T0, class ..._T>
struct __check_complete<_H, _T0, _T...>
    : private __check_complete<_H>,
      private __check_complete<_T0, _T...>
d2824 3
a2826 3
template <class _H>
struct __check_complete<_H, _H>
    : private __check_complete<_H>
d2830 2
a2831 2
template <class _T>
struct __check_complete<_T>
d2833 1
a2833 1
    static_assert(sizeof(_T) > 0, "Type must be complete.");
d2836 3
a2838 3
template <class _T>
struct __check_complete<_T&>
    : private __check_complete<_T>
d2842 3
a2844 3
template <class _T>
struct __check_complete<_T&&>
    : private __check_complete<_T>
d2848 2
a2849 2
template <class _R, class ..._Param>
struct __check_complete<_R (*)(_Param...)>
d2854 2
a2855 2
template <class _R, class ..._Param>
struct __check_complete<_R (_Param...)>
d2860 2
a2861 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...)>
d2866 2
a2867 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const>
d2872 2
a2873 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) volatile>
d2878 2
a2879 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const volatile>
d2886 2
a2887 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) &>
d2892 2
a2893 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const&>
d2898 2
a2899 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) volatile&>
d2904 2
a2905 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const volatile&>
d2910 2
a2911 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) &&>
d2916 2
a2917 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const&&>
d2922 2
a2923 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) volatile&&>
d2928 2
a2929 2
template <class _R, class _Class, class ..._Param>
struct __check_complete<_R (_Class::*)(_Param...) const volatile&&>
d2936 2
a2937 2
template <class _R, class _Class>
struct __check_complete<_R _Class::*>
d2953 1
a2953 1
template <class _F, class _A0, class ..._Args>
d2955 1
a2955 1
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
d2958 1
a2958 1
template <class _F, class _A0, class ..._Args>
d2960 1
a2960 1
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
d2965 1
a2965 1
template <class _F, class _A0>
d2967 1
a2967 1
__invoke(_F&& __f, _A0&& __a0)
d2970 1
a2970 1
template <class _F, class _A0>
d2972 1
a2972 1
__invoke(_F&& __f, _A0&& __a0)
d2977 1
a2977 1
template <class _F, class ..._Args>
d2979 2
a2980 2
__invoke(_F&& __f, _Args&& ...__args)
    -> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...));
d2984 1
a2984 1
template <class _F, class ..._Args>
d2986 1
a2986 1
    : private __check_complete<_F, _Args...>
d2989 1
a2989 1
            __invoke(_VSTD::declval<_F>(), _VSTD::declval<_Args>()...)
d2994 1
a2994 1
template <class _F, class ..._Args>
d2997 1
a2997 1
          __invokable_imp<_F, _Args...>::value>
d3003 1
a3003 1
template <bool _Invokable, class _F, class ..._Args>
d3008 2
a3009 2
template <class _F, class ..._Args>
struct __invoke_of_imp<true, _F, _Args...>
d3011 1
a3011 1
    typedef typename __invokable_imp<_F, _Args...>::type type;
d3014 1
a3014 1
template <class _F, class ..._Args>
d3016 1
a3016 1
    : public __invoke_of_imp<__invokable<_F, _Args...>::value, _F, _Args...>
@

