Make sure that are class type

This commit is contained in:
Kohei Takahashi
2018-05-08 13:09:46 +09:00
parent f9e618d825
commit dfa3650307
2 changed files with 72 additions and 65 deletions

View File

@ -26,6 +26,8 @@
# include <boost/type_traits/remove_cv.hpp>
# include <boost/type_traits/remove_all_extents.hpp>
# include <boost/type_traits/is_scalar.hpp>
# include <boost/type_traits/is_class.hpp>
# include <boost/type_traits/is_union.hpp>
# include <boost/type_traits/is_constructible.hpp>
# include <boost/type_traits/is_assignable.hpp>
# include <boost/type_traits/is_copy_constructible.hpp>
@ -46,6 +48,7 @@
#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 2
#elif defined(BOOST_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && \
defined(BOOST_IS_UNION) && defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) && \
defined(BOOST_HAS_TRIVIAL_ASSIGN) && defined(BOOST_HAS_TRIVIAL_COPY) && \
defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) && defined(BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR) && \
defined(BOOST_HAS_TRIVIAL_DESTRUCTOR) && defined(BOOST_TT_IS_CONSTRUCTIBLE_CONFORMING)
@ -77,7 +80,11 @@ struct is_trivially_copyable_impl
#else
, mpl::true_
#endif
, is_trivially_copyable_class<typename remove_cv<T>::type> >::type { };
, typename mpl::if_c<is_class<T>::value || is_union<T>::value
, is_trivially_copyable_class<typename remove_cv<T>::type>
, mpl::false_
>::type
>::type { };
#endif // <type_traits>
template <typename T>

View File

@ -83,20 +83,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<int(*const)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<int(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<int(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<int(&&)[]>));
@ -189,20 +189,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<function_type*(*const)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<function_type*(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<function_type*(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const*(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type volatile*(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const volatile*(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const*(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type volatile*(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const volatile*(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const*(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type volatile*(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const volatile*(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const*(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type volatile*(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const volatile*(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const*(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type volatile*(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type const volatile*(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<function_type*(&&)[]>));
@ -265,20 +265,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<member_type(*const)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<member_type(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<member_type(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_type(&&)[]>));
@ -341,20 +341,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<member_function_type(*const)[][3][4][5]>
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<member_function_type(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<member_function_type(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<member_function_type(&&)[]>));
@ -438,20 +438,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<trivial(*const)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<trivial(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<trivial(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<trivial(&&)[]>));
@ -535,20 +535,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<user_provided_copy(*const)[][3][4][5]>))
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_copy(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_copy(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_copy(&&)[]>));
@ -631,20 +631,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<user_provided_move(*const)[][3][4][5]>))
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_move(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_move(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move(&&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_move const(&&)[]>));
@ -727,20 +727,20 @@ BOOST_MPL_ASSERT((is_trivially_copyable<user_provided_dtor(*const)[][3][4][5]>))
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_dtor(*volatile)[][3][4][5]>));
BOOST_FUSION_ASSERT_WA((is_trivially_copyable<user_provided_dtor(*const volatile)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor volatile(&)[]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const volatile(&)[]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor volatile(&)[3]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const volatile(&)[3]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor volatile(&)[][3][4][5]>));
//BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor volatile(&)[][3][4][5]>));
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor const volatile(&)[][3][4][5]>));
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_MPL_ASSERT_NOT((is_trivially_copyable<user_provided_dtor(&&)[]>));