// (C) Copyright Edward Diener 2019 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_TTI_DETAIL_UNION_HPP) #define BOOST_TTI_DETAIL_UNION_HPP #include #include #include #include #include #include #include #include #include #include #include #define BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_UNION(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_union_invoke) \ { \ BOOST_MPL_ASSERT((BOOST_TTI_NAMESPACE::detail::is_lambda_expression)); \ typedef typename boost::mpl::apply::type type; \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_UNION_OP_CHOOSE(trait,name) \ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(trait,_detail_union_mpl), name, false) \ BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_UNION(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_union_op_choose) : \ boost::mpl::and_ \ < \ boost::is_union, \ BOOST_PP_CAT(trait,_detail_union_invoke) \ > \ { \ }; \ \ template \ struct BOOST_PP_CAT(trait,_detail_union_op_choose) : \ boost::mpl::false_ \ { \ }; \ \ template \ struct BOOST_PP_CAT(trait,_detail_union_op_choose) : \ boost::is_union \ { \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_UNION_OP(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_UNION_OP_CHOOSE(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_union_op) : \ BOOST_PP_CAT(trait,_detail_union_op_choose) \ < \ BOOST_TTI_DETAIL_TP_T, \ BOOST_TTI_DETAIL_TP_U, \ typename BOOST_PP_CAT(trait,_detail_union_mpl)::type \ > \ { \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_UNION(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_UNION_OP(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_union) : \ boost::mpl::eval_if \ < \ BOOST_TTI_NAMESPACE::detail::enclosing_type, \ BOOST_PP_CAT(trait,_detail_union_op), \ boost::mpl::false_ \ > \ { \ }; \ /**/ #endif // BOOST_TTI_DETAIL_UNION_HPP