Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:54

0001 
0002 //  (C) Copyright Edward Diener 2019
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 
0007 #if !defined(BOOST_TTI_DETAIL_ENUM_HPP)
0008 #define BOOST_TTI_DETAIL_ENUM_HPP
0009 
0010 #include <boost/mpl/and.hpp>
0011 #include <boost/mpl/apply.hpp>
0012 #include <boost/mpl/bool.hpp>
0013 #include <boost/mpl/eval_if.hpp>
0014 #include <boost/mpl/has_xxx.hpp>
0015 #include <boost/preprocessor/cat.hpp>
0016 #include <boost/tti/detail/ddeftype.hpp>
0017 #include <boost/tti/detail/dlambda.hpp>
0018 #include <boost/tti/detail/denclosing_type.hpp>
0019 #include <boost/tti/gen/namespace_gen.hpp>
0020 #include <boost/type_traits/is_enum.hpp>
0021 
0022 #define BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_ENUM(trait,name) \
0023 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_MFC> \
0024 struct BOOST_PP_CAT(trait,_detail_enum_invoke) \
0025   { \
0026   BOOST_MPL_ASSERT((BOOST_TTI_NAMESPACE::detail::is_lambda_expression<BOOST_TTI_DETAIL_TP_MFC>)); \
0027   typedef typename boost::mpl::apply<BOOST_TTI_DETAIL_TP_MFC,typename BOOST_TTI_DETAIL_TP_T::name>::type type; \
0028   }; \
0029 /**/
0030 
0031 #define BOOST_TTI_DETAIL_TRAIT_HAS_ENUM_OP_CHOOSE(trait,name) \
0032 BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(trait,_detail_enum_mpl), name, false) \
0033 BOOST_TTI_DETAIL_TRAIT_INVOKE_HAS_ENUM(trait,name) \
0034 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U,class BOOST_TTI_DETAIL_TP_B> \
0035 struct BOOST_PP_CAT(trait,_detail_enum_op_choose) : \
0036   boost::mpl::and_ \
0037     < \
0038     boost::is_enum<typename BOOST_TTI_DETAIL_TP_T::name>, \
0039     BOOST_PP_CAT(trait,_detail_enum_invoke)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U> \
0040     > \
0041   { \
0042   }; \
0043 \
0044 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0045 struct BOOST_PP_CAT(trait,_detail_enum_op_choose)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U,boost::mpl::false_::type> : \
0046   boost::mpl::false_ \
0047   { \
0048   }; \
0049 \
0050 template<class BOOST_TTI_DETAIL_TP_T> \
0051 struct BOOST_PP_CAT(trait,_detail_enum_op_choose)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_NAMESPACE::detail::deftype,boost::mpl::true_::type> : \
0052   boost::is_enum<typename BOOST_TTI_DETAIL_TP_T::name> \
0053   { \
0054   }; \
0055 /**/
0056 
0057 #define BOOST_TTI_DETAIL_TRAIT_HAS_ENUM_OP(trait,name) \
0058 BOOST_TTI_DETAIL_TRAIT_HAS_ENUM_OP_CHOOSE(trait,name) \
0059 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0060 struct BOOST_PP_CAT(trait,_detail_enum_op) : \
0061   BOOST_PP_CAT(trait,_detail_enum_op_choose) \
0062     < \
0063     BOOST_TTI_DETAIL_TP_T, \
0064     BOOST_TTI_DETAIL_TP_U, \
0065     typename BOOST_PP_CAT(trait,_detail_enum_mpl)<BOOST_TTI_DETAIL_TP_T>::type \
0066     > \
0067   { \
0068   }; \
0069 /**/
0070 
0071 #define BOOST_TTI_DETAIL_TRAIT_HAS_ENUM(trait,name) \
0072 BOOST_TTI_DETAIL_TRAIT_HAS_ENUM_OP(trait,name) \
0073 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_U> \
0074 struct BOOST_PP_CAT(trait,_detail_enum) : \
0075     boost::mpl::eval_if \
0076         < \
0077         BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
0078         BOOST_PP_CAT(trait,_detail_enum_op)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_U>, \
0079         boost::mpl::false_ \
0080         > \
0081   { \
0082   }; \
0083 /**/
0084 
0085 #endif // BOOST_TTI_DETAIL_ENUM_HPP