forked from OSchip/llvm-project
Patch for N3655 (Transformation type traits) with Howard's additions
llvm-svn: 185597
This commit is contained in:
parent
f33ec531fa
commit
5b2ef2b1a6
|
@ -137,6 +137,64 @@ namespace std
|
|||
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
|
||||
|
||||
*/
|
||||
|
@ -154,9 +212,18 @@ template <bool _Bp, class _If, class _Then>
|
|||
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:
|
||||
|
@ -191,16 +258,25 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS is_volatile<_Tp volatile> : public
|
|||
|
||||
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
|
||||
|
||||
|
@ -446,6 +522,10 @@ 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 ||
|
||||
|
@ -459,11 +539,19 @@ 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;};
|
||||
|
@ -472,6 +560,10 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS remove_reference<_Tp&> {typedef _T
|
|||
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;};
|
||||
|
@ -481,6 +573,10 @@ template <> struct _LIBCPP_TYPE_VIS add_lvalue_reference<const void>
|
|||
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;};
|
||||
|
@ -489,6 +585,10 @@ template <> struct _LIBCPP_TYPE_VIS add_rvalue_reference<const void>
|
|||
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
|
||||
|
@ -518,11 +618,19 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS remove_pointer<_Tp* const>
|
|||
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>
|
||||
|
@ -584,6 +692,10 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS remove_extent<_Tp[]>
|
|||
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
|
||||
|
@ -593,6 +705,10 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS remove_all_extents<_Tp[]>
|
|||
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
|
||||
|
@ -916,7 +1032,7 @@ 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>
|
||||
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;
|
||||
|
@ -928,6 +1044,11 @@ struct _LIBCPP_TYPE_VIS aligned_storage
|
|||
};
|
||||
};
|
||||
|
||||
#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>\
|
||||
|
@ -989,6 +1110,10 @@ struct aligned_union
|
|||
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
|
||||
|
@ -1150,6 +1275,10 @@ 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 {};
|
||||
|
||||
|
@ -1175,6 +1304,10 @@ 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>
|
||||
|
@ -1233,6 +1366,10 @@ 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
|
||||
|
@ -1411,6 +1548,10 @@ public:
|
|||
>::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>
|
||||
|
@ -2984,6 +3125,10 @@ class _LIBCPP_TYPE_VIS result_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>
|
||||
|
@ -3078,6 +3223,10 @@ 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>
|
||||
|
|
|
@ -13,6 +13,24 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_convertible()
|
||||
{
|
||||
static_assert((std::is_convertible<T, U>::value), "");
|
||||
static_assert((std::is_convertible<const T, U>::value), "");
|
||||
static_assert((std::is_convertible<T, const U>::value), "");
|
||||
static_assert((std::is_convertible<const T, const U>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_not_convertible()
|
||||
{
|
||||
static_assert((!std::is_convertible<T, U>::value), "");
|
||||
static_assert((!std::is_convertible<const T, U>::value), "");
|
||||
static_assert((!std::is_convertible<T, const U>::value), "");
|
||||
static_assert((!std::is_convertible<const T, const U>::value), "");
|
||||
}
|
||||
|
||||
typedef void Function();
|
||||
typedef char Array[1];
|
||||
|
||||
|
@ -22,353 +40,143 @@ class NonCopyable {
|
|||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
static_assert(( std::is_convertible<void, void>::value), "");
|
||||
static_assert(( std::is_convertible<const void, void>::value), "");
|
||||
static_assert(( std::is_convertible<void, const void>::value), "");
|
||||
static_assert(( std::is_convertible<const void, const void>::value), "");
|
||||
// void
|
||||
test_is_convertible<void,void> ();
|
||||
test_is_not_convertible<void,Function> ();
|
||||
test_is_not_convertible<void,Function&> ();
|
||||
test_is_not_convertible<void,Function*> ();
|
||||
test_is_not_convertible<void,Array> ();
|
||||
test_is_not_convertible<void,Array&> ();
|
||||
test_is_not_convertible<void,char> ();
|
||||
test_is_not_convertible<void,char&> ();
|
||||
test_is_not_convertible<void,char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Function>::value), "");
|
||||
// Function
|
||||
test_is_not_convertible<Function, void> ();
|
||||
test_is_not_convertible<Function, Function> ();
|
||||
test_is_convertible<Function, Function&> ();
|
||||
test_is_convertible<Function, Function*> ();
|
||||
test_is_not_convertible<Function, Array> ();
|
||||
test_is_not_convertible<Function, Array&> ();
|
||||
test_is_not_convertible<Function, char> ();
|
||||
test_is_not_convertible<Function, char&> ();
|
||||
test_is_not_convertible<Function, char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Function&>::value), "");
|
||||
// Function&
|
||||
test_is_not_convertible<Function&, void> ();
|
||||
test_is_not_convertible<Function&, Function> ();
|
||||
test_is_convertible<Function&, Function&> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<void, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Function*const >::value), "");
|
||||
test_is_convertible<Function&, Function*> ();
|
||||
test_is_not_convertible<Function&, Array> ();
|
||||
test_is_not_convertible<Function&, Array&> ();
|
||||
test_is_not_convertible<Function&, char> ();
|
||||
test_is_not_convertible<Function&, char&> ();
|
||||
test_is_not_convertible<Function&, char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, Array>::value), "");
|
||||
static_assert((!std::is_convertible<void, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const void, const Array>::value), "");
|
||||
// Function*
|
||||
test_is_not_convertible<Function*, void> ();
|
||||
test_is_not_convertible<Function*, Function> ();
|
||||
test_is_not_convertible<Function*, Function&> ();
|
||||
test_is_convertible<Function*, Function*> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<void, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const void, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const void, const Array&>::value), "");
|
||||
test_is_not_convertible<Function*, Array> ();
|
||||
test_is_not_convertible<Function*, Array&> ();
|
||||
test_is_not_convertible<Function*, char> ();
|
||||
test_is_not_convertible<Function*, char&> ();
|
||||
test_is_not_convertible<Function*, char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<void, char>::value), "");
|
||||
static_assert((!std::is_convertible<void, const char>::value), "");
|
||||
static_assert((!std::is_convertible<const void, char>::value), "");
|
||||
static_assert((!std::is_convertible<const void, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<void, char&>::value), "");
|
||||
static_assert((!std::is_convertible<void, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const void, char&>::value), "");
|
||||
static_assert((!std::is_convertible<const void, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<void, char*>::value), "");
|
||||
static_assert((!std::is_convertible<void, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const void, char*>::value), "");
|
||||
static_assert((!std::is_convertible<const void, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<Function, void>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, Function>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<Function, Function&>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<Function, Function*>::value), "");
|
||||
static_assert(( std::is_convertible<Function, Function* const>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, char>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function, char*>::value), "");
|
||||
static_assert((!std::is_convertible<Function, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<Function&, void>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, Function>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<Function&, Function&>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<Function&, Function*>::value), "");
|
||||
static_assert(( std::is_convertible<Function&, Function* const>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, char>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function&, char*>::value), "");
|
||||
static_assert((!std::is_convertible<Function&, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<Function*, void>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, void>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const void>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, Function>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, Function&>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<Function*, Function*>::value), "");
|
||||
static_assert(( std::is_convertible<Function*, Function* const>::value), "");
|
||||
static_assert(( std::is_convertible<Function*const, Function*>::value), "");
|
||||
static_assert(( std::is_convertible<Function*const, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, char>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const char>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, char>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Function*, char*>::value), "");
|
||||
static_assert((!std::is_convertible<Function*, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, char*>::value), "");
|
||||
static_assert((!std::is_convertible<Function*const, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<Array, void>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, void>::value), "");
|
||||
static_assert((!std::is_convertible<Array, const void>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Function&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<Array, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Array, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, const Array>::value), "");
|
||||
// Array
|
||||
test_is_not_convertible<Array, void> ();
|
||||
test_is_not_convertible<Array, Function> ();
|
||||
test_is_not_convertible<Array, Function&> ();
|
||||
test_is_not_convertible<Array, Function*> ();
|
||||
test_is_not_convertible<Array, Array> ();
|
||||
|
||||
static_assert((!std::is_convertible<Array, Array&>::value), "");
|
||||
static_assert(( std::is_convertible<Array, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, Array&>::value), "");
|
||||
static_assert(( std::is_convertible<const Array, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, char>::value), "");
|
||||
static_assert((!std::is_convertible<Array, const char>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, char>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Array, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, char&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, const char&>::value), "");
|
||||
test_is_not_convertible<Array, char> ();
|
||||
test_is_not_convertible<Array, char&> ();
|
||||
|
||||
static_assert(( std::is_convertible<Array, char*>::value), "");
|
||||
static_assert(( std::is_convertible<Array, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const Array, char*>::value), "");
|
||||
static_assert(( std::is_convertible<const Array, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<Array&, void>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, void>::value), "");
|
||||
static_assert((!std::is_convertible<Array&, const void>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Function&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<Array&, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, Array>::value), "");
|
||||
static_assert((!std::is_convertible<Array&, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, const Array>::value), "");
|
||||
// Array&
|
||||
test_is_not_convertible<Array&, void> ();
|
||||
test_is_not_convertible<Array&, Function> ();
|
||||
test_is_not_convertible<Array&, Function&> ();
|
||||
test_is_not_convertible<Array&, Function*> ();
|
||||
test_is_not_convertible<Array&, Array> ();
|
||||
|
||||
static_assert(( std::is_convertible<Array&, Array&>::value), "");
|
||||
static_assert(( std::is_convertible<Array&, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, Array&>::value), "");
|
||||
static_assert(( std::is_convertible<const Array&, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, char>::value), "");
|
||||
static_assert((!std::is_convertible<Array&, const char>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, char>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<Array&, char&>::value), "");
|
||||
static_assert((!std::is_convertible<Array&, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, char&>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, const char&>::value), "");
|
||||
test_is_not_convertible<Array&, char> ();
|
||||
test_is_not_convertible<Array&, char&> ();
|
||||
|
||||
static_assert(( std::is_convertible<Array&, char*>::value), "");
|
||||
static_assert(( std::is_convertible<Array&, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const Array&, char*>::value), "");
|
||||
static_assert(( std::is_convertible<const Array&, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<char, void>::value), "");
|
||||
static_assert((!std::is_convertible<const char, void>::value), "");
|
||||
static_assert((!std::is_convertible<char, const void>::value), "");
|
||||
static_assert((!std::is_convertible<const char, const void>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Function&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<char, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, Array>::value), "");
|
||||
static_assert((!std::is_convertible<char, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<char, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char, const Array&>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<char, char>::value), "");
|
||||
static_assert(( std::is_convertible<char, const char>::value), "");
|
||||
static_assert(( std::is_convertible<const char, char>::value), "");
|
||||
static_assert(( std::is_convertible<const char, const char>::value), "");
|
||||
// char
|
||||
test_is_not_convertible<char, void> ();
|
||||
test_is_not_convertible<char, Function> ();
|
||||
test_is_not_convertible<char, Function&> ();
|
||||
test_is_not_convertible<char, Function*> ();
|
||||
test_is_not_convertible<char, Array> ();
|
||||
test_is_not_convertible<char, Array&> ();
|
||||
|
||||
test_is_convertible<char, char> ();
|
||||
|
||||
static_assert((!std::is_convertible<char, char&>::value), "");
|
||||
static_assert(( std::is_convertible<char, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const char, char&>::value), "");
|
||||
static_assert(( std::is_convertible<const char, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char, char*>::value), "");
|
||||
static_assert((!std::is_convertible<char, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const char, char*>::value), "");
|
||||
static_assert((!std::is_convertible<const char, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<char&, void>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, void>::value), "");
|
||||
static_assert((!std::is_convertible<char&, const void>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, const void>::value), "");
|
||||
test_is_not_convertible<char, char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<char&, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char&, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Function&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char&, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<char&, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char&, Array>::value), "");
|
||||
static_assert((!std::is_convertible<char&, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char&, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<char&, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, const Array&>::value), "");
|
||||
|
||||
static_assert(( std::is_convertible<char&, char>::value), "");
|
||||
static_assert(( std::is_convertible<char&, const char>::value), "");
|
||||
static_assert(( std::is_convertible<const char&, char>::value), "");
|
||||
static_assert(( std::is_convertible<const char&, const char>::value), "");
|
||||
// char&
|
||||
test_is_not_convertible<char&, void> ();
|
||||
test_is_not_convertible<char&, Function> ();
|
||||
test_is_not_convertible<char&, Function&> ();
|
||||
test_is_not_convertible<char&, Function*> ();
|
||||
test_is_not_convertible<char&, Array> ();
|
||||
test_is_not_convertible<char&, Array&> ();
|
||||
|
||||
test_is_convertible<char&, char> ();
|
||||
|
||||
static_assert(( std::is_convertible<char&, char&>::value), "");
|
||||
static_assert(( std::is_convertible<char&, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, char&>::value), "");
|
||||
static_assert(( std::is_convertible<const char&, const char&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char&, char*>::value), "");
|
||||
static_assert((!std::is_convertible<char&, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, char*>::value), "");
|
||||
static_assert((!std::is_convertible<const char&, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
static_assert((!std::is_convertible<char*, void>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, void>::value), "");
|
||||
static_assert((!std::is_convertible<char*, const void>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, const void>::value), "");
|
||||
test_is_not_convertible<char&, char*> ();
|
||||
|
||||
static_assert((!std::is_convertible<char*, Function>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Function>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, Function&>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Function&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<char*, Function* const>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Function*>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Function*const >::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, Array>::value), "");
|
||||
static_assert((!std::is_convertible<char*, const Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Array>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, const Array>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<char*, const Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, Array&>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, const Array&>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, char>::value), "");
|
||||
static_assert((!std::is_convertible<char*, const char>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, char>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, const char>::value), "");
|
||||
|
||||
static_assert((!std::is_convertible<char*, char&>::value), "");
|
||||
static_assert((!std::is_convertible<char*, const char&>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, char&>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, const char&>::value), "");
|
||||
// char*
|
||||
test_is_not_convertible<char*, void> ();
|
||||
test_is_not_convertible<char*, Function> ();
|
||||
test_is_not_convertible<char*, Function&> ();
|
||||
test_is_not_convertible<char*, Function*> ();
|
||||
test_is_not_convertible<char*, Array> ();
|
||||
test_is_not_convertible<char*, Array&> ();
|
||||
|
||||
test_is_not_convertible<char*, char> ();
|
||||
test_is_not_convertible<char*, char&> ();
|
||||
|
||||
static_assert(( std::is_convertible<char*, char*>::value), "");
|
||||
static_assert(( std::is_convertible<char*, const char*>::value), "");
|
||||
static_assert((!std::is_convertible<const char*, char*>::value), "");
|
||||
static_assert(( std::is_convertible<const char*, const char*>::value), "");
|
||||
}
|
||||
{
|
||||
|
||||
// NonCopyable
|
||||
static_assert((std::is_convertible<NonCopyable&, NonCopyable&>::value), "");
|
||||
static_assert((std::is_convertible<NonCopyable&, const NonCopyable&>::value), "");
|
||||
static_assert((std::is_convertible<NonCopyable&, const volatile NonCopyable&>::value), "");
|
||||
|
@ -378,5 +186,4 @@ int main()
|
|||
static_assert((std::is_convertible<volatile NonCopyable&, const volatile NonCopyable&>::value), "");
|
||||
static_assert((std::is_convertible<const volatile NonCopyable&, const volatile NonCopyable&>::value), "");
|
||||
static_assert((!std::is_convertible<const NonCopyable&, NonCopyable&>::value), "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,27 @@
|
|||
|
||||
enum Enum {zero, one_};
|
||||
|
||||
template <class T, class U>
|
||||
void test_remove_all_extents()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_all_extents<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_all_extents_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_same<std::remove_all_extents<int>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const Enum>::type, const Enum>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<int[]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const int[]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<int[3]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const int[3]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<int[][3]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const int[][3]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<int[2][3]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const int[2][3]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<int[1][2][3]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_all_extents<const int[1][2][3]>::type, const int>::value), "");
|
||||
test_remove_all_extents<int, int> ();
|
||||
test_remove_all_extents<const Enum, const Enum> ();
|
||||
test_remove_all_extents<int[], int> ();
|
||||
test_remove_all_extents<const int[], const int> ();
|
||||
test_remove_all_extents<int[3], int> ();
|
||||
test_remove_all_extents<const int[3], const int> ();
|
||||
test_remove_all_extents<int[][3], int> ();
|
||||
test_remove_all_extents<const int[][3], const int> ();
|
||||
test_remove_all_extents<int[2][3], int> ();
|
||||
test_remove_all_extents<const int[2][3], const int> ();
|
||||
test_remove_all_extents<int[1][2][3], int> ();
|
||||
test_remove_all_extents<const int[1][2][3], const int> ();
|
||||
}
|
||||
|
|
|
@ -15,18 +15,28 @@
|
|||
|
||||
enum Enum {zero, one_};
|
||||
|
||||
template <class T, class U>
|
||||
void test_remove_extent()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_extent<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_extent_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_same<std::remove_extent<int>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const Enum>::type, const Enum>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<int[]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const int[]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<int[3]>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const int[3]>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<int[][3]>::type, int[3]>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const int[][3]>::type, const int[3]>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<int[2][3]>::type, int[3]>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const int[2][3]>::type, const int[3]>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<int[1][2][3]>::type, int[2][3]>::value), "");
|
||||
static_assert((std::is_same<std::remove_extent<const int[1][2][3]>::type, const int[2][3]>::value), "");
|
||||
test_remove_extent<int, int> ();
|
||||
test_remove_extent<const Enum, const Enum> ();
|
||||
test_remove_extent<int[], int> ();
|
||||
test_remove_extent<const int[], const int> ();
|
||||
test_remove_extent<int[3], int> ();
|
||||
test_remove_extent<const int[3], const int> ();
|
||||
test_remove_extent<int[][3], int[3]> ();
|
||||
test_remove_extent<const int[][3], const int[3]> ();
|
||||
test_remove_extent<int[2][3], int[3]> ();
|
||||
test_remove_extent<const int[2][3], const int[3]> ();
|
||||
test_remove_extent<int[1][2][3], int[2][3]> ();
|
||||
test_remove_extent<const int[1][2][3], const int[2][3]> ();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_add_const_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_const_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_add_cv_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_cv_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_add_volatile_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_volatile_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_remove_const_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_const_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_remove_cv_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_cv_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_remove_volatile_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_volatile_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,106 +17,169 @@ int main()
|
|||
{
|
||||
{
|
||||
typedef std::aligned_storage<10, 1 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 1>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 1, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10, 2 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 2>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10, 4 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 4>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 12, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10, 8 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 8>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10, 16 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 16>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 16, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10, 32 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10, 32>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 32, "");
|
||||
static_assert(sizeof(T1) == 32, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<20, 32 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<20, 32>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 32, "");
|
||||
static_assert(sizeof(T1) == 32, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<40, 32 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<40, 32>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 32, "");
|
||||
static_assert(sizeof(T1) == 64, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<12, 16 >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<12, 16>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 16, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<1>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<1>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 1, "");
|
||||
static_assert(sizeof(T1) == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<2>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<2>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<3>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<3>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<4>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<4>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<5>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<5>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 8, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<7>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<7>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 8, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<8>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<8>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 8, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<9>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<9>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<15>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<15>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<16>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 16, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<17>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 16, "");
|
||||
static_assert(sizeof(T1) == 32, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_storage<10>::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_storage_t<10>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
|
|
|
@ -18,46 +18,73 @@ int main()
|
|||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
{
|
||||
typedef std::aligned_union<10, char >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, char>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 1, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<10, short >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, short>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<10, int >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, int>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 12, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<10, double >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, double>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 8, "");
|
||||
static_assert(sizeof(T1) == 16, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<10, short, char >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, short, char>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<10, char, short >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<10, char, short>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 2, "");
|
||||
static_assert(sizeof(T1) == 10, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<2, int, char, short >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, int, char, short>, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<2, char, int, short >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, char, int, short >, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
{
|
||||
typedef std::aligned_union<2, char, short, int >::type T1;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(std::is_same<std::aligned_union_t<2, char, short, int >, T1>::value, "" );
|
||||
#endif
|
||||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
|
|
|
@ -17,10 +17,22 @@ int main()
|
|||
{
|
||||
static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::common_type_t<int>, int>::value), "");
|
||||
static_assert((std::is_same<std::common_type_t<char>, char>::value), "");
|
||||
#endif
|
||||
|
||||
static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
|
||||
static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::common_type_t<double, char>, double>::value), "");
|
||||
static_assert((std::is_same<std::common_type_t<short, char>, int>::value), "");
|
||||
#endif
|
||||
|
||||
static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
|
||||
static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::common_type_t<double, char, long long>, double>::value), "");
|
||||
static_assert((std::is_same<std::common_type_t<unsigned, char, long long>, long long>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -17,4 +17,8 @@ int main()
|
|||
{
|
||||
static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
|
||||
static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::conditional_t<true, char, int>, char>::value), "");
|
||||
static_assert((std::is_same<std::conditional_t<false, char, int>, int>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_decay()
|
||||
{
|
||||
static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::decay_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -17,4 +17,8 @@ int main()
|
|||
{
|
||||
static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
|
||||
static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::enable_if_t<true>, void>::value), "");
|
||||
static_assert((std::is_same<std::enable_if_t<true, int>, int>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// type_traits
|
||||
|
||||
// enable_if
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::enable_if_t<false> A;
|
||||
#else
|
||||
static_assert ( false, "" );
|
||||
#endif
|
||||
}
|
|
@ -34,8 +34,36 @@ struct wat
|
|||
void foo();
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
void test_result_of_imp()
|
||||
{
|
||||
static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_result_of_imp<S(int), short> ();
|
||||
test_result_of_imp<S&(unsigned char, int&), double> ();
|
||||
test_result_of_imp<PF1(), bool> ();
|
||||
test_result_of_imp<PMS(std::unique_ptr<S>, int), void> ();
|
||||
test_result_of_imp<PMS(S, int), void> ();
|
||||
test_result_of_imp<PMS(const S&, int), void> ();
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test_result_of_imp<PMD(S), char&&> ();
|
||||
#endif
|
||||
test_result_of_imp<PMD(const S*), const char&> ();
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
using type1 = std::result_of<decltype(&wat::foo)(wat)>::type;
|
||||
#endif
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
using type2 = std::result_of_t<decltype(&wat::foo)(wat)>;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!");
|
||||
static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
|
||||
static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
|
||||
|
@ -46,5 +74,7 @@ int main()
|
|||
static_assert((std::is_same<std::result_of<PMD(S)>::type, char&&>::value), "Error!");
|
||||
#endif
|
||||
static_assert((std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value), "Error!");
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
using type = std::result_of<decltype(&wat::foo)(wat)>::type;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -14,20 +14,28 @@
|
|||
#include <type_traits>
|
||||
#include <climits>
|
||||
|
||||
enum E { V = INT_MIN };
|
||||
enum F { W = UINT_MAX };
|
||||
|
||||
int main()
|
||||
{
|
||||
enum E { V = INT_MIN };
|
||||
enum F { W = UINT_MAX };
|
||||
|
||||
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
|
||||
"E has the wrong underlying type");
|
||||
static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
|
||||
"F has the wrong underlying type");
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::underlying_type_t<E>, int>::value), "");
|
||||
static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), "");
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_strong_enums)
|
||||
enum G : char { };
|
||||
|
||||
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
|
||||
"G has the wrong underlying type");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::underlying_type_t<G>, char>::value), "");
|
||||
#endif
|
||||
#endif // __has_feature(cxx_strong_enums)
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_add_pointer()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_pointer_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_remove_pointer()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_pointer_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_add_lvalue_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_lvalue_reference_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -19,6 +19,9 @@ template <class T, class U>
|
|||
void test_add_rvalue_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::add_rvalue_reference_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
|
|
@ -17,6 +17,9 @@ template <class T, class U>
|
|||
void test_remove_reference()
|
||||
{
|
||||
static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::remove_reference_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -21,22 +21,30 @@ enum BigEnum
|
|||
big = 0xFFFFFFFFFFFFFFFFULL
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
void test_make_signed()
|
||||
{
|
||||
static_assert((std::is_same<typename std::make_signed<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::make_signed_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
|
||||
static_assert((std::is_same<std::make_signed<BigEnum>::type,
|
||||
std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
|
||||
test_make_signed< signed char, signed char >();
|
||||
test_make_signed< unsigned char, signed char >();
|
||||
test_make_signed< char, signed char >();
|
||||
test_make_signed< short, signed short >();
|
||||
test_make_signed< unsigned short, signed short >();
|
||||
test_make_signed< int, signed int >();
|
||||
test_make_signed< unsigned int, signed int >();
|
||||
test_make_signed< long, signed long >();
|
||||
test_make_signed< unsigned long, long >();
|
||||
test_make_signed< long long, signed long long >();
|
||||
test_make_signed< unsigned long long, signed long long >();
|
||||
test_make_signed< wchar_t, int >();
|
||||
test_make_signed< const wchar_t, const int >();
|
||||
test_make_signed< const Enum, const int >();
|
||||
test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >();
|
||||
}
|
||||
|
|
|
@ -21,22 +21,31 @@ enum BigEnum
|
|||
big = 0xFFFFFFFFFFFFFFFFULL
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
void test_make_unsigned()
|
||||
{
|
||||
static_assert((std::is_same<typename std::make_unsigned<T>::type, U>::value), "");
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert((std::is_same<std::make_unsigned_t<T>, U>::value), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_same<std::make_unsigned<signed char>::type, unsigned char>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<unsigned char>::type, unsigned char>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<char>::type, unsigned char>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<short>::type, unsigned short>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<unsigned short>::type, unsigned short>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<int>::type, unsigned int>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<unsigned int>::type, unsigned int>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<long>::type, unsigned long>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), "");
|
||||
static_assert((std::is_same<std::make_unsigned<BigEnum>::type,
|
||||
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), "");
|
||||
test_make_unsigned<signed char, unsigned char> ();
|
||||
test_make_unsigned<unsigned char, unsigned char> ();
|
||||
test_make_unsigned<char, unsigned char> ();
|
||||
test_make_unsigned<short, unsigned short> ();
|
||||
test_make_unsigned<unsigned short, unsigned short> ();
|
||||
test_make_unsigned<int, unsigned int> ();
|
||||
test_make_unsigned<unsigned int, unsigned int> ();
|
||||
test_make_unsigned<long, unsigned long> ();
|
||||
test_make_unsigned<unsigned long, unsigned long> ();
|
||||
test_make_unsigned<long long, unsigned long long> ();
|
||||
test_make_unsigned<unsigned long long, unsigned long long> ();
|
||||
test_make_unsigned<wchar_t, unsigned int> ();
|
||||
test_make_unsigned<const wchar_t, const unsigned int> ();
|
||||
test_make_unsigned<const Enum, const unsigned int> ();
|
||||
test_make_unsigned<BigEnum,
|
||||
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type> ();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
template <class T>
|
||||
void test_rvalue_ref()
|
||||
{
|
||||
static_assert(std::is_reference<T>::value, "");
|
||||
static_assert( std::is_reference<T>::value, "");
|
||||
static_assert(!std::is_arithmetic<T>::value, "");
|
||||
static_assert(!std::is_fundamental<T>::value, "");
|
||||
static_assert(!std::is_object<T>::value, "");
|
||||
|
|
|
@ -22,17 +22,32 @@ struct B
|
|||
void operator=(A);
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_assignable()
|
||||
{
|
||||
static_assert(( std::is_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_not_assignable()
|
||||
{
|
||||
static_assert((!std::is_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_assignable<int&, int&>::value), "");
|
||||
static_assert(( std::is_assignable<int&, int>::value), "");
|
||||
static_assert((!std::is_assignable<int, int&>::value), "");
|
||||
static_assert((!std::is_assignable<int, int>::value), "");
|
||||
static_assert(( std::is_assignable<int&, double>::value), "");
|
||||
static_assert(( std::is_assignable<B, A>::value), "");
|
||||
static_assert((!std::is_assignable<A, B>::value), "");
|
||||
static_assert((!std::is_assignable<void, const void>::value), "");
|
||||
static_assert((!std::is_assignable<const void, const void>::value), "");
|
||||
static_assert(( std::is_assignable<void*&, void*>::value), "");
|
||||
static_assert((!std::is_assignable<int(), int>::value), "");
|
||||
test_is_assignable<int&, int&> ();
|
||||
test_is_assignable<int&, int> ();
|
||||
test_is_assignable<int&, double> ();
|
||||
test_is_assignable<B, A> ();
|
||||
test_is_assignable<void*&, void*> ();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test_is_not_assignable<int, int&> ();
|
||||
test_is_not_assignable<int, int> ();
|
||||
#endif
|
||||
test_is_not_assignable<A, B> ();
|
||||
test_is_not_assignable<void, const void> ();
|
||||
test_is_not_assignable<const void, const void> ();
|
||||
test_is_not_assignable<int(), int> ();
|
||||
}
|
||||
|
|
|
@ -18,20 +18,57 @@ struct A
|
|||
{
|
||||
explicit A(int);
|
||||
A(int, double);
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
private:
|
||||
#endif
|
||||
A(char);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void test_is_constructible()
|
||||
{
|
||||
static_assert( (std::is_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_constructible()
|
||||
{
|
||||
static_assert( (std::is_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0, class A1>
|
||||
void test_is_constructible()
|
||||
{
|
||||
static_assert( (std::is_constructible<T, A0, A1>::value), "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_constructible()
|
||||
{
|
||||
static_assert((!std::is_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_not_constructible()
|
||||
{
|
||||
static_assert((!std::is_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_constructible<int>::value), "");
|
||||
static_assert((std::is_constructible<int, const int>::value), "");
|
||||
static_assert((std::is_constructible<A, int>::value), "");
|
||||
static_assert((std::is_constructible<A, int, double>::value), "");
|
||||
static_assert((!std::is_constructible<A>::value), "");
|
||||
static_assert((!std::is_constructible<A, char>::value), "");
|
||||
static_assert((!std::is_constructible<A, void>::value), "");
|
||||
static_assert((!std::is_constructible<void>::value), "");
|
||||
static_assert((!std::is_constructible<int&>::value), "");
|
||||
static_assert(( std::is_constructible<int&, int&>::value), "");
|
||||
test_is_constructible<int> ();
|
||||
test_is_constructible<int, const int> ();
|
||||
test_is_constructible<A, int> ();
|
||||
test_is_constructible<A, int, double> ();
|
||||
test_is_constructible<int&, int&> ();
|
||||
|
||||
test_is_not_constructible<A> ();
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_not_constructible<A, char> ();
|
||||
#else
|
||||
test_is_constructible<A, char> ();
|
||||
#endif
|
||||
test_is_not_constructible<A, void> ();
|
||||
test_is_not_constructible<void> ();
|
||||
test_is_not_constructible<int&> ();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,18 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_copy_assignable()
|
||||
{
|
||||
static_assert(( std::is_copy_assignable<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_copy_assignable()
|
||||
{
|
||||
static_assert((!std::is_copy_assignable<T>::value), "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
{
|
||||
};
|
||||
|
@ -42,16 +54,21 @@ class B
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_copy_assignable<int>::value), "");
|
||||
static_assert((!std::is_copy_assignable<const int>::value), "");
|
||||
static_assert((!std::is_copy_assignable<int[]>::value), "");
|
||||
static_assert((!std::is_copy_assignable<int[3]>::value), "");
|
||||
static_assert(( std::is_copy_assignable<int&>::value), "");
|
||||
static_assert(( std::is_copy_assignable<A>::value), "");
|
||||
static_assert(( std::is_copy_assignable<bit_zero>::value), "");
|
||||
static_assert(( std::is_copy_assignable<Union>::value), "");
|
||||
static_assert(( std::is_copy_assignable<NotEmpty>::value), "");
|
||||
static_assert(( std::is_copy_assignable<Empty>::value), "");
|
||||
static_assert((!std::is_copy_assignable<B>::value), "");
|
||||
static_assert((!std::is_copy_assignable<void>::value), "");
|
||||
test_is_copy_assignable<int> ();
|
||||
test_is_copy_assignable<int&> ();
|
||||
test_is_copy_assignable<A> ();
|
||||
test_is_copy_assignable<bit_zero> ();
|
||||
test_is_copy_assignable<Union> ();
|
||||
test_is_copy_assignable<NotEmpty> ();
|
||||
test_is_copy_assignable<Empty> ();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test_is_not_copy_assignable<const int> ();
|
||||
test_is_not_copy_assignable<int[]> ();
|
||||
test_is_not_copy_assignable<int[3]> ();
|
||||
#endif
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_not_copy_assignable<B> ();
|
||||
#endif
|
||||
test_is_not_copy_assignable<void> ();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_is_copy_constructible()
|
||||
{
|
||||
static_assert(std::is_copy_constructible<T>::value == Result, "");
|
||||
static_assert( std::is_copy_constructible<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_copy_constructible()
|
||||
{
|
||||
static_assert(!std::is_copy_constructible<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -54,20 +60,22 @@ class B
|
|||
|
||||
int main()
|
||||
{
|
||||
test_is_copy_constructible<char[3], false>();
|
||||
test_is_copy_constructible<char[], false>();
|
||||
test_is_copy_constructible<void, false>();
|
||||
test_is_copy_constructible<Abstract, false>();
|
||||
test_is_copy_constructible<A>();
|
||||
test_is_copy_constructible<int&>();
|
||||
test_is_copy_constructible<Union>();
|
||||
test_is_copy_constructible<Empty>();
|
||||
test_is_copy_constructible<int>();
|
||||
test_is_copy_constructible<double>();
|
||||
test_is_copy_constructible<int*>();
|
||||
test_is_copy_constructible<const int*>();
|
||||
test_is_copy_constructible<NotEmpty>();
|
||||
test_is_copy_constructible<bit_zero>();
|
||||
|
||||
test_is_copy_constructible<A, true>();
|
||||
test_is_copy_constructible<B, false>();
|
||||
test_is_copy_constructible<int&, true>();
|
||||
test_is_copy_constructible<Union, true>();
|
||||
test_is_copy_constructible<Empty, true>();
|
||||
test_is_copy_constructible<int, true>();
|
||||
test_is_copy_constructible<double, true>();
|
||||
test_is_copy_constructible<int*, true>();
|
||||
test_is_copy_constructible<const int*, true>();
|
||||
test_is_copy_constructible<NotEmpty, true>();
|
||||
test_is_copy_constructible<bit_zero, true>();
|
||||
test_is_not_copy_constructible<char[3]>();
|
||||
test_is_not_copy_constructible<char[]>();
|
||||
test_is_not_copy_constructible<void>();
|
||||
test_is_not_copy_constructible<Abstract>();
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_not_copy_constructible<B>();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -13,13 +13,22 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_is_default_constructible()
|
||||
{
|
||||
static_assert(std::is_default_constructible<T>::value == Result, "");
|
||||
static_assert(std::is_default_constructible<const T>::value == Result, "");
|
||||
static_assert(std::is_default_constructible<volatile T>::value == Result, "");
|
||||
static_assert(std::is_default_constructible<const volatile T>::value == Result, "");
|
||||
static_assert( std::is_default_constructible<T>::value, "");
|
||||
static_assert( std::is_default_constructible<const T>::value, "");
|
||||
static_assert( std::is_default_constructible<volatile T>::value, "");
|
||||
static_assert( std::is_default_constructible<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_default_constructible()
|
||||
{
|
||||
static_assert(!std::is_default_constructible<T>::value, "");
|
||||
static_assert(!std::is_default_constructible<const T>::value, "");
|
||||
static_assert(!std::is_default_constructible<volatile T>::value, "");
|
||||
static_assert(!std::is_default_constructible<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -57,20 +66,22 @@ class B
|
|||
|
||||
int main()
|
||||
{
|
||||
test_is_default_constructible<void, false>();
|
||||
test_is_default_constructible<int&, false>();
|
||||
test_is_default_constructible<char[], false>();
|
||||
test_is_default_constructible<Abstract, false>();
|
||||
test_is_default_constructible<A>();
|
||||
test_is_default_constructible<Union>();
|
||||
test_is_default_constructible<Empty>();
|
||||
test_is_default_constructible<int>();
|
||||
test_is_default_constructible<double>();
|
||||
test_is_default_constructible<int*>();
|
||||
test_is_default_constructible<const int*>();
|
||||
test_is_default_constructible<char[3]>();
|
||||
test_is_default_constructible<NotEmpty>();
|
||||
test_is_default_constructible<bit_zero>();
|
||||
|
||||
test_is_default_constructible<A, true>();
|
||||
test_is_default_constructible<B, false>();
|
||||
test_is_default_constructible<Union, true>();
|
||||
test_is_default_constructible<Empty, true>();
|
||||
test_is_default_constructible<int, true>();
|
||||
test_is_default_constructible<double, true>();
|
||||
test_is_default_constructible<int*, true>();
|
||||
test_is_default_constructible<const int*, true>();
|
||||
test_is_default_constructible<char[3], true>();
|
||||
test_is_default_constructible<NotEmpty, true>();
|
||||
test_is_default_constructible<bit_zero, true>();
|
||||
test_is_not_default_constructible<void>();
|
||||
test_is_not_default_constructible<int&>();
|
||||
test_is_not_default_constructible<char[]>();
|
||||
test_is_not_default_constructible<Abstract>();
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_not_default_constructible<B>();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -13,13 +13,22 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_is_destructible()
|
||||
{
|
||||
static_assert( std::is_destructible<T>::value == Result, "");
|
||||
static_assert( std::is_destructible<const T>::value == Result, "");
|
||||
static_assert( std::is_destructible<volatile T>::value == Result, "");
|
||||
static_assert( std::is_destructible<const volatile T>::value == Result, "");
|
||||
static_assert( std::is_destructible<T>::value, "");
|
||||
static_assert( std::is_destructible<const T>::value, "");
|
||||
static_assert( std::is_destructible<volatile T>::value, "");
|
||||
static_assert( std::is_destructible<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_destructible()
|
||||
{
|
||||
static_assert(!std::is_destructible<T>::value, "");
|
||||
static_assert(!std::is_destructible<const T>::value, "");
|
||||
static_assert(!std::is_destructible<volatile T>::value, "");
|
||||
static_assert(!std::is_destructible<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -50,17 +59,20 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
test_is_destructible<void, false>();
|
||||
test_is_destructible<A, true>();
|
||||
test_is_destructible<Abstract, false>();
|
||||
test_is_destructible<NotEmpty, false>();
|
||||
test_is_destructible<int&, true>();
|
||||
test_is_destructible<Union, true>();
|
||||
test_is_destructible<Empty, true>();
|
||||
test_is_destructible<int, true>();
|
||||
test_is_destructible<double, true>();
|
||||
test_is_destructible<int*, true>();
|
||||
test_is_destructible<const int*, true>();
|
||||
test_is_destructible<char[3], true>();
|
||||
test_is_destructible<bit_zero, true>();
|
||||
test_is_destructible<A>();
|
||||
test_is_destructible<int&>();
|
||||
test_is_destructible<Union>();
|
||||
test_is_destructible<Empty>();
|
||||
test_is_destructible<int>();
|
||||
test_is_destructible<double>();
|
||||
test_is_destructible<int*>();
|
||||
test_is_destructible<const int*>();
|
||||
test_is_destructible<char[3]>();
|
||||
test_is_destructible<bit_zero>();
|
||||
|
||||
test_is_not_destructible<void>();
|
||||
test_is_not_destructible<Abstract>();
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_not_destructible<NotEmpty>();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -13,6 +13,18 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_literal_type()
|
||||
{
|
||||
static_assert( std::is_literal_type<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_literal_type()
|
||||
{
|
||||
static_assert(!std::is_literal_type<T>::value, "");
|
||||
}
|
||||
|
||||
struct A
|
||||
{
|
||||
};
|
||||
|
@ -24,10 +36,11 @@ struct B
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert( std::is_literal_type<int>::value, "");
|
||||
static_assert( std::is_literal_type<const int>::value, "");
|
||||
static_assert( std::is_literal_type<int&>::value, "");
|
||||
static_assert( std::is_literal_type<volatile int&>::value, "");
|
||||
static_assert( std::is_literal_type<A>::value, "");
|
||||
static_assert(!std::is_literal_type<B>::value, "");
|
||||
test_is_literal_type<int> ();
|
||||
test_is_literal_type<const int> ();
|
||||
test_is_literal_type<int&> ();
|
||||
test_is_literal_type<volatile int&> ();
|
||||
test_is_literal_type<A> ();
|
||||
|
||||
test_is_not_literal_type<B> ();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,18 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_move_assignable()
|
||||
{
|
||||
static_assert( std::is_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_move_assignable()
|
||||
{
|
||||
static_assert(!std::is_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
{
|
||||
};
|
||||
|
@ -37,15 +49,18 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_move_assignable<int>::value), "");
|
||||
static_assert((!std::is_move_assignable<const int>::value), "");
|
||||
static_assert((!std::is_move_assignable<int[]>::value), "");
|
||||
static_assert((!std::is_move_assignable<int[3]>::value), "");
|
||||
static_assert((!std::is_move_assignable<int[3]>::value), "");
|
||||
static_assert((!std::is_move_assignable<void>::value), "");
|
||||
static_assert(( std::is_move_assignable<A>::value), "");
|
||||
static_assert(( std::is_move_assignable<bit_zero>::value), "");
|
||||
static_assert(( std::is_move_assignable<Union>::value), "");
|
||||
static_assert(( std::is_move_assignable<NotEmpty>::value), "");
|
||||
static_assert(( std::is_move_assignable<Empty>::value), "");
|
||||
test_is_move_assignable<int> ();
|
||||
test_is_move_assignable<A> ();
|
||||
test_is_move_assignable<bit_zero> ();
|
||||
test_is_move_assignable<Union> ();
|
||||
test_is_move_assignable<NotEmpty> ();
|
||||
test_is_move_assignable<Empty> ();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test_is_not_move_assignable<const int> ();
|
||||
test_is_not_move_assignable<int[]> ();
|
||||
test_is_not_move_assignable<int[3]> ();
|
||||
test_is_not_move_assignable<int[3]> ();
|
||||
#endif
|
||||
test_is_not_move_assignable<void> ();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_is_move_constructible()
|
||||
{
|
||||
static_assert(std::is_move_constructible<T>::value == Result, "");
|
||||
static_assert( std::is_move_constructible<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_move_constructible()
|
||||
{
|
||||
static_assert(!std::is_move_constructible<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -49,25 +55,27 @@ struct A
|
|||
|
||||
struct B
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
B(B&&);
|
||||
#endif
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
test_is_move_constructible<char[3], false>();
|
||||
test_is_move_constructible<char[], false>();
|
||||
test_is_move_constructible<void, false>();
|
||||
test_is_move_constructible<Abstract, false>();
|
||||
test_is_not_move_constructible<char[3]>();
|
||||
test_is_not_move_constructible<char[]>();
|
||||
test_is_not_move_constructible<void>();
|
||||
test_is_not_move_constructible<Abstract>();
|
||||
|
||||
test_is_move_constructible<A, true>();
|
||||
test_is_move_constructible<int&, true>();
|
||||
test_is_move_constructible<Union, true>();
|
||||
test_is_move_constructible<Empty, true>();
|
||||
test_is_move_constructible<int, true>();
|
||||
test_is_move_constructible<double, true>();
|
||||
test_is_move_constructible<int*, true>();
|
||||
test_is_move_constructible<const int*, true>();
|
||||
test_is_move_constructible<NotEmpty, true>();
|
||||
test_is_move_constructible<bit_zero, true>();
|
||||
test_is_move_constructible<B, true>();
|
||||
test_is_move_constructible<A>();
|
||||
test_is_move_constructible<int&>();
|
||||
test_is_move_constructible<Union>();
|
||||
test_is_move_constructible<Empty>();
|
||||
test_is_move_constructible<int>();
|
||||
test_is_move_constructible<double>();
|
||||
test_is_move_constructible<int*>();
|
||||
test_is_move_constructible<const int*>();
|
||||
test_is_move_constructible<NotEmpty>();
|
||||
test_is_move_constructible<bit_zero>();
|
||||
test_is_move_constructible<B>();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,18 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_nothrow_assignable()
|
||||
{
|
||||
static_assert(( std::is_nothrow_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_not_nothrow_assignable()
|
||||
{
|
||||
static_assert((!std::is_nothrow_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
struct A
|
||||
{
|
||||
};
|
||||
|
@ -24,11 +36,14 @@ struct B
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_nothrow_assignable<int&, int&>::value), "");
|
||||
static_assert(( std::is_nothrow_assignable<int&, int>::value), "");
|
||||
static_assert((!std::is_nothrow_assignable<int, int&>::value), "");
|
||||
static_assert((!std::is_nothrow_assignable<int, int>::value), "");
|
||||
static_assert(( std::is_nothrow_assignable<int&, double>::value), "");
|
||||
static_assert((!std::is_nothrow_assignable<B, A>::value), "");
|
||||
static_assert((!std::is_nothrow_assignable<A, B>::value), "");
|
||||
test_is_nothrow_assignable<int&, int&> ();
|
||||
test_is_nothrow_assignable<int&, int> ();
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test_is_nothrow_assignable<int&, double> ();
|
||||
#endif
|
||||
|
||||
test_is_not_nothrow_assignable<int, int&> ();
|
||||
test_is_not_nothrow_assignable<int, int> ();
|
||||
test_is_not_nothrow_assignable<B, A> ();
|
||||
test_is_not_nothrow_assignable<A, B> ();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,36 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_nothrow_constructible()
|
||||
{
|
||||
static_assert(( std::is_nothrow_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_nothrow_constructible()
|
||||
{
|
||||
static_assert(( std::is_nothrow_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_nothrow_constructible()
|
||||
{
|
||||
static_assert((!std::is_nothrow_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_not_nothrow_constructible()
|
||||
{
|
||||
static_assert((!std::is_nothrow_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0, class A1>
|
||||
void test_is_not_nothrow_constructible()
|
||||
{
|
||||
static_assert((!std::is_nothrow_constructible<T, A0, A1>::value), "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
{
|
||||
};
|
||||
|
@ -42,11 +72,12 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_nothrow_constructible<int>::value), "");
|
||||
static_assert(( std::is_nothrow_constructible<int, const int&>::value), "");
|
||||
static_assert((!std::is_nothrow_constructible<A, int>::value), "");
|
||||
static_assert((!std::is_nothrow_constructible<A, int, double>::value), "");
|
||||
static_assert((!std::is_nothrow_constructible<A>::value), "");
|
||||
static_assert(( std::is_nothrow_constructible<Empty>::value), "");
|
||||
static_assert(( std::is_nothrow_constructible<Empty, const Empty&>::value), "");
|
||||
test_is_nothrow_constructible<int> ();
|
||||
test_is_nothrow_constructible<int, const int&> ();
|
||||
test_is_nothrow_constructible<Empty> ();
|
||||
test_is_nothrow_constructible<Empty, const Empty&> ();
|
||||
|
||||
test_is_not_nothrow_constructible<A, int> ();
|
||||
test_is_not_nothrow_constructible<A, int, double> ();
|
||||
test_is_not_nothrow_constructible<A> ();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_has_nothrow_assign()
|
||||
{
|
||||
static_assert(std::is_nothrow_copy_assignable<T>::value == Result, "");
|
||||
static_assert( std::is_nothrow_copy_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_has_not_nothrow_assign()
|
||||
{
|
||||
static_assert(!std::is_nothrow_copy_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -42,17 +48,18 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
test_has_nothrow_assign<const int, false>();
|
||||
test_has_nothrow_assign<void, false>();
|
||||
test_has_nothrow_assign<A, false>();
|
||||
test_has_nothrow_assign<int&, true>();
|
||||
test_has_nothrow_assign<int&>();
|
||||
test_has_nothrow_assign<Union>();
|
||||
test_has_nothrow_assign<Empty>();
|
||||
test_has_nothrow_assign<int>();
|
||||
test_has_nothrow_assign<double>();
|
||||
test_has_nothrow_assign<int*>();
|
||||
test_has_nothrow_assign<const int*>();
|
||||
test_has_nothrow_assign<NotEmpty>();
|
||||
test_has_nothrow_assign<bit_zero>();
|
||||
|
||||
test_has_not_nothrow_assign<const int>();
|
||||
test_has_not_nothrow_assign<void>();
|
||||
test_has_not_nothrow_assign<A>();
|
||||
|
||||
test_has_nothrow_assign<Union, true>();
|
||||
test_has_nothrow_assign<Empty, true>();
|
||||
test_has_nothrow_assign<int, true>();
|
||||
test_has_nothrow_assign<double, true>();
|
||||
test_has_nothrow_assign<int*, true>();
|
||||
test_has_nothrow_assign<const int*, true>();
|
||||
test_has_nothrow_assign<NotEmpty, true>();
|
||||
test_has_nothrow_assign<bit_zero, true>();
|
||||
}
|
||||
|
|
|
@ -63,15 +63,23 @@ int main()
|
|||
test_has_not_nothrow_destructor<Abstract>();
|
||||
test_has_not_nothrow_destructor<NotEmpty>();
|
||||
|
||||
#if __has_feature(cxx_noexcept)
|
||||
test_is_nothrow_destructible<A>();
|
||||
#endif
|
||||
test_is_nothrow_destructible<int&>();
|
||||
#if __has_feature(cxx_unrestricted_unions)
|
||||
test_is_nothrow_destructible<Union>();
|
||||
#endif
|
||||
#if __has_feature(cxx_access_control_sfinae)
|
||||
test_is_nothrow_destructible<Empty>();
|
||||
#endif
|
||||
test_is_nothrow_destructible<int>();
|
||||
test_is_nothrow_destructible<double>();
|
||||
test_is_nothrow_destructible<int*>();
|
||||
test_is_nothrow_destructible<const int*>();
|
||||
test_is_nothrow_destructible<char[3]>();
|
||||
test_is_nothrow_destructible<char[3]>();
|
||||
#if __has_feature(cxx_noexcept)
|
||||
test_is_nothrow_destructible<bit_zero>();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_has_nothrow_assign()
|
||||
{
|
||||
static_assert(std::is_nothrow_move_assignable<T>::value == Result, "");
|
||||
static_assert( std::is_nothrow_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_has_not_nothrow_assign()
|
||||
{
|
||||
static_assert(!std::is_nothrow_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -42,16 +48,16 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
test_has_nothrow_assign<void, false>();
|
||||
test_has_nothrow_assign<A, false>();
|
||||
test_has_nothrow_assign<int&, true>();
|
||||
test_has_nothrow_assign<int&>();
|
||||
test_has_nothrow_assign<Union>();
|
||||
test_has_nothrow_assign<Empty>();
|
||||
test_has_nothrow_assign<int>();
|
||||
test_has_nothrow_assign<double>();
|
||||
test_has_nothrow_assign<int*>();
|
||||
test_has_nothrow_assign<const int*>();
|
||||
test_has_nothrow_assign<NotEmpty>();
|
||||
test_has_nothrow_assign<bit_zero>();
|
||||
|
||||
test_has_nothrow_assign<Union, true>();
|
||||
test_has_nothrow_assign<Empty, true>();
|
||||
test_has_nothrow_assign<int, true>();
|
||||
test_has_nothrow_assign<double, true>();
|
||||
test_has_nothrow_assign<int*, true>();
|
||||
test_has_nothrow_assign<const int*, true>();
|
||||
test_has_nothrow_assign<NotEmpty, true>();
|
||||
test_has_nothrow_assign<bit_zero, true>();
|
||||
test_has_not_nothrow_assign<void>();
|
||||
test_has_not_nothrow_assign<A>();
|
||||
}
|
||||
|
|
|
@ -52,8 +52,13 @@ class Abstract
|
|||
virtual ~Abstract() = 0;
|
||||
};
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
class Final final {
|
||||
};
|
||||
#else
|
||||
class Final {
|
||||
};
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
@ -13,6 +13,24 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_standard_layout()
|
||||
{
|
||||
static_assert( std::is_standard_layout<T>::value, "");
|
||||
static_assert( std::is_standard_layout<const T>::value, "");
|
||||
static_assert( std::is_standard_layout<volatile T>::value, "");
|
||||
static_assert( std::is_standard_layout<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_standard_layout()
|
||||
{
|
||||
static_assert(!std::is_standard_layout<T>::value, "");
|
||||
static_assert(!std::is_standard_layout<const T>::value, "");
|
||||
static_assert(!std::is_standard_layout<volatile T>::value, "");
|
||||
static_assert(!std::is_standard_layout<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
struct pair
|
||||
{
|
||||
|
@ -22,9 +40,9 @@ struct pair
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert( std::is_standard_layout<int>::value, "");
|
||||
static_assert( std::is_standard_layout<int[3]>::value, "");
|
||||
static_assert(!std::is_standard_layout<int&>::value, "");
|
||||
static_assert(!std::is_standard_layout<volatile int&>::value, "");
|
||||
static_assert(( std::is_standard_layout<pair<int, double> >::value), "");
|
||||
test_is_standard_layout<int> ();
|
||||
test_is_standard_layout<int[3]> ();
|
||||
test_is_standard_layout<pair<int, double> > ();
|
||||
|
||||
test_is_not_standard_layout<int&> ();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,24 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_trivial()
|
||||
{
|
||||
static_assert( std::is_trivial<T>::value, "");
|
||||
static_assert( std::is_trivial<const T>::value, "");
|
||||
static_assert( std::is_trivial<volatile T>::value, "");
|
||||
static_assert( std::is_trivial<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_trivial()
|
||||
{
|
||||
static_assert(!std::is_trivial<T>::value, "");
|
||||
static_assert(!std::is_trivial<const T>::value, "");
|
||||
static_assert(!std::is_trivial<volatile T>::value, "");
|
||||
static_assert(!std::is_trivial<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
struct A {};
|
||||
|
||||
class B
|
||||
|
@ -23,9 +41,10 @@ public:
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert( std::is_trivial<int>::value, "");
|
||||
static_assert(!std::is_trivial<int&>::value, "");
|
||||
static_assert(!std::is_trivial<volatile int&>::value, "");
|
||||
static_assert( std::is_trivial<A>::value, "");
|
||||
static_assert(!std::is_trivial<B>::value, "");
|
||||
test_is_trivial<int> ();
|
||||
test_is_trivial<A> ();
|
||||
|
||||
test_is_not_trivial<int&> ();
|
||||
test_is_not_trivial<volatile int&> ();
|
||||
test_is_not_trivial<B> ();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,24 @@
|
|||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
template <class T>
|
||||
void test_is_trivially_copyable()
|
||||
{
|
||||
static_assert( std::is_trivially_copyable<T>::value, "");
|
||||
static_assert( std::is_trivially_copyable<const T>::value, "");
|
||||
static_assert( std::is_trivially_copyable<volatile T>::value, "");
|
||||
static_assert( std::is_trivially_copyable<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_trivially_copyable()
|
||||
{
|
||||
static_assert(!std::is_trivially_copyable<T>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<const T>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<volatile T>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
struct A
|
||||
{
|
||||
int i_;
|
||||
|
@ -33,12 +51,13 @@ public:
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert( std::is_trivially_copyable<int>::value, "");
|
||||
static_assert( std::is_trivially_copyable<const int>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<int&>::value, "");
|
||||
static_assert( std::is_trivially_copyable<A>::value, "");
|
||||
static_assert( std::is_trivially_copyable<const A>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<const A&>::value, "");
|
||||
static_assert(!std::is_trivially_copyable<B>::value, "");
|
||||
static_assert( std::is_trivially_copyable<C>::value, "");
|
||||
test_is_trivially_copyable<int> ();
|
||||
test_is_trivially_copyable<const int> ();
|
||||
test_is_trivially_copyable<A> ();
|
||||
test_is_trivially_copyable<const A> ();
|
||||
test_is_trivially_copyable<C> ();
|
||||
|
||||
test_is_not_trivially_copyable<int&> ();
|
||||
test_is_not_trivially_copyable<const A&> ();
|
||||
test_is_not_trivially_copyable<B> ();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,18 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_trivially_assignable()
|
||||
{
|
||||
static_assert(( std::is_trivially_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
void test_is_not_trivially_assignable()
|
||||
{
|
||||
static_assert((!std::is_trivially_assignable<T, U>::value), "");
|
||||
}
|
||||
|
||||
struct A
|
||||
{
|
||||
};
|
||||
|
@ -24,11 +36,12 @@ struct B
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_trivially_assignable<int&, int&>::value), "");
|
||||
static_assert(( std::is_trivially_assignable<int&, int>::value), "");
|
||||
static_assert((!std::is_trivially_assignable<int, int&>::value), "");
|
||||
static_assert((!std::is_trivially_assignable<int, int>::value), "");
|
||||
static_assert(( std::is_trivially_assignable<int&, double>::value), "");
|
||||
static_assert((!std::is_trivially_assignable<B, A>::value), "");
|
||||
static_assert((!std::is_trivially_assignable<A, B>::value), "");
|
||||
test_is_trivially_assignable<int&, int&> ();
|
||||
test_is_trivially_assignable<int&, int> ();
|
||||
test_is_trivially_assignable<int&, double> ();
|
||||
|
||||
test_is_not_trivially_assignable<int, int&> ();
|
||||
test_is_not_trivially_assignable<int, int> ();
|
||||
test_is_not_trivially_assignable<B, A> ();
|
||||
test_is_not_trivially_assignable<A, B> ();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,36 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void test_is_trivially_constructible()
|
||||
{
|
||||
static_assert(( std::is_trivially_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_trivially_constructible()
|
||||
{
|
||||
static_assert(( std::is_trivially_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_is_not_trivially_constructible()
|
||||
{
|
||||
static_assert((!std::is_trivially_constructible<T>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0>
|
||||
void test_is_not_trivially_constructible()
|
||||
{
|
||||
static_assert((!std::is_trivially_constructible<T, A0>::value), "");
|
||||
}
|
||||
|
||||
template <class T, class A0, class A1>
|
||||
void test_is_not_trivially_constructible()
|
||||
{
|
||||
static_assert((!std::is_trivially_constructible<T, A0, A1>::value), "");
|
||||
}
|
||||
|
||||
struct A
|
||||
{
|
||||
explicit A(int);
|
||||
|
@ -22,9 +52,10 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
static_assert(( std::is_trivially_constructible<int>::value), "");
|
||||
static_assert(( std::is_trivially_constructible<int, const int&>::value), "");
|
||||
static_assert((!std::is_trivially_constructible<A, int>::value), "");
|
||||
static_assert((!std::is_trivially_constructible<A, int, double>::value), "");
|
||||
static_assert((!std::is_trivially_constructible<A>::value), "");
|
||||
test_is_trivially_constructible<int> ();
|
||||
test_is_trivially_constructible<int, const int&> ();
|
||||
|
||||
test_is_not_trivially_constructible<A, int> ();
|
||||
test_is_not_trivially_constructible<A, int, double> ();
|
||||
test_is_not_trivially_constructible<A> ();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
void test_has_trivial_assign()
|
||||
template <class T>
|
||||
void test_has_trivially_copy_assignable()
|
||||
{
|
||||
static_assert(std::is_trivially_copy_assignable<T>::value == Result, "");
|
||||
static_assert( std::is_trivially_copy_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_has_not_trivially_copy_assignable()
|
||||
{
|
||||
static_assert(!std::is_trivially_copy_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -47,18 +53,19 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
test_has_trivial_assign<void, false>();
|
||||
test_has_trivial_assign<A, false>();
|
||||
test_has_trivial_assign<int&, true>();
|
||||
test_has_trivial_assign<NotEmpty, false>();
|
||||
test_has_trivial_assign<Abstract, false>();
|
||||
test_has_trivial_assign<const Empty, false>();
|
||||
test_has_trivially_copy_assignable<int&>();
|
||||
test_has_trivially_copy_assignable<Union>();
|
||||
test_has_trivially_copy_assignable<Empty>();
|
||||
test_has_trivially_copy_assignable<int>();
|
||||
test_has_trivially_copy_assignable<double>();
|
||||
test_has_trivially_copy_assignable<int*>();
|
||||
test_has_trivially_copy_assignable<const int*>();
|
||||
test_has_trivially_copy_assignable<bit_zero>();
|
||||
|
||||
test_has_not_trivially_copy_assignable<void>();
|
||||
test_has_not_trivially_copy_assignable<A>();
|
||||
test_has_not_trivially_copy_assignable<NotEmpty>();
|
||||
test_has_not_trivially_copy_assignable<Abstract>();
|
||||
test_has_not_trivially_copy_assignable<const Empty>();
|
||||
|
||||
test_has_trivial_assign<Union, true>();
|
||||
test_has_trivial_assign<Empty, true>();
|
||||
test_has_trivial_assign<int, true>();
|
||||
test_has_trivial_assign<double, true>();
|
||||
test_has_trivial_assign<int*, true>();
|
||||
test_has_trivial_assign<const int*, true>();
|
||||
test_has_trivial_assign<bit_zero, true>();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,16 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, bool Result>
|
||||
template <class T>
|
||||
void test_has_trivial_assign()
|
||||
{
|
||||
static_assert(std::is_trivially_move_assignable<T>::value == Result, "");
|
||||
static_assert( std::is_trivially_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_has_not_trivial_assign()
|
||||
{
|
||||
static_assert(!std::is_trivially_move_assignable<T>::value, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
|
@ -47,18 +53,19 @@ struct A
|
|||
|
||||
int main()
|
||||
{
|
||||
test_has_trivial_assign<void, false>();
|
||||
test_has_trivial_assign<A, false>();
|
||||
test_has_trivial_assign<int&, true>();
|
||||
test_has_trivial_assign<NotEmpty, false>();
|
||||
test_has_trivial_assign<Abstract, false>();
|
||||
test_has_trivial_assign<const Empty, false>();
|
||||
test_has_trivial_assign<int&>();
|
||||
test_has_trivial_assign<Union>();
|
||||
test_has_trivial_assign<Empty>();
|
||||
test_has_trivial_assign<int>();
|
||||
test_has_trivial_assign<double>();
|
||||
test_has_trivial_assign<int*>();
|
||||
test_has_trivial_assign<const int*>();
|
||||
test_has_trivial_assign<bit_zero>();
|
||||
|
||||
test_has_not_trivial_assign<void>();
|
||||
test_has_not_trivial_assign<A>();
|
||||
test_has_not_trivial_assign<NotEmpty>();
|
||||
test_has_not_trivial_assign<Abstract>();
|
||||
test_has_not_trivial_assign<const Empty>();
|
||||
|
||||
test_has_trivial_assign<Union, true>();
|
||||
test_has_trivial_assign<Empty, true>();
|
||||
test_has_trivial_assign<int, true>();
|
||||
test_has_trivial_assign<double, true>();
|
||||
test_has_trivial_assign<int*, true>();
|
||||
test_has_trivial_assign<const int*, true>();
|
||||
test_has_trivial_assign<bit_zero, true>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue