Updated type traits workaround deleted copy constructors

This commit is contained in:
Ion Gaztañaga
2015-01-17 19:59:33 +01:00
parent 35a8b69c94
commit 63d45d2fdd
2 changed files with 43 additions and 39 deletions

View File

@@ -116,39 +116,13 @@ struct add_const<T&&>
////////////////////////////////////// //////////////////////////////////////
template<class T> template<class T>
struct add_lvalue_reference struct add_lvalue_reference
{ { typedef T& type; };
typedef T& type;
};
template<class T> template<class T> struct add_lvalue_reference<T&> { typedef T& type; };
struct add_lvalue_reference<T&> template<> struct add_lvalue_reference<void> { typedef void type; };
{ template<> struct add_lvalue_reference<const void> { typedef const void type; };
typedef T& type; template<> struct add_lvalue_reference<volatile void> { typedef volatile void type; };
}; template<> struct add_lvalue_reference<const volatile void>{ typedef const volatile void type; };
template<>
struct add_lvalue_reference<void>
{
typedef void type;
};
template<>
struct add_lvalue_reference<const void>
{
typedef const void type;
};
template<>
struct add_lvalue_reference<volatile void>
{
typedef volatile void type;
};
template<>
struct add_lvalue_reference<const volatile void>
{
typedef const volatile void type;
};
template<class T> template<class T>
struct add_const_lvalue_reference struct add_const_lvalue_reference

View File

@@ -104,7 +104,9 @@
# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
# endif # endif
# if __has_feature(has_trivial_copy) # if __has_feature(has_trivial_copy)
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)) # //There are problems with deleted copy constructors detected as trivially copyable.
# //http://stackoverflow.com/questions/12754886/has-trivial-copy-behaves-differently-in-clang-and-gcc-whos-right
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && ::boost::move_detail::is_copy_constructible<T>::value)
# endif # endif
# if __has_feature(has_trivial_assign) # if __has_feature(has_trivial_assign)
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) ) # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) )
@@ -529,6 +531,35 @@ struct is_function
: is_function_impl<T> : is_function_impl<T>
{}; {};
//////////////////////////////////////
// is_arithmetic
//////////////////////////////////////
template <class T>
struct is_arithmetic
{
static const bool value = is_floating_point<T>::value ||
is_integral<T>::value;
};
//////////////////////////////////////
// is_member_function_pointer
//////////////////////////////////////
template <class T>
struct is_member_function_pointer_cv
{
static const bool value = false;
};
template <class T, class C>
struct is_member_function_pointer_cv<T C::*>
: is_function<T>
{};
template <class T>
struct is_member_function_pointer
: is_member_function_pointer_cv<typename remove_cv<T>::type>
{};
////////////////////////////////////// //////////////////////////////////////
// is_enum // is_enum
////////////////////////////////////// //////////////////////////////////////
@@ -537,15 +568,14 @@ struct is_function
template <class T> template <class T>
struct is_enum_nonintrinsic struct is_enum_nonintrinsic
{ {
static const bool value = !is_void<T>::value && static const bool value = !is_arithmetic<T>::value &&
!is_floating_point<T>::value && !is_reference<T>::value &&
!is_integral<T>::value && !is_class_or_union<T>::value &&
!is_array<T>::value &&
!is_void<T>::value &&
!is_nullptr_t<T>::value && !is_nullptr_t<T>::value &&
!is_member_pointer<T>::value && !is_member_pointer<T>::value &&
!is_pointer<T>::value && !is_pointer<T>::value &&
!is_array<T>::value &&
!is_class_or_union<T>::value &&
!is_reference<T>::value &&
!is_function<T>::value; !is_function<T>::value;
}; };
#endif #endif