File indexing completed on 2025-01-30 10:02:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP
0014 #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP
0015
0016 #include <boost/variant/detail/enable_recursive_fwd.hpp>
0017 #include <boost/variant/variant_fwd.hpp>
0018
0019 #if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
0020 # include <boost/mpl/apply.hpp>
0021 # include <boost/mpl/eval_if.hpp>
0022 # include <boost/mpl/lambda.hpp>
0023 #endif
0024
0025 #include <boost/variant/detail/substitute.hpp>
0026 #include <boost/mpl/aux_/config/ctps.hpp>
0027 #include <boost/mpl/bool_fwd.hpp>
0028 #include <boost/mpl/if.hpp>
0029 #include <boost/mpl/or.hpp>
0030 #include <boost/type_traits/is_pointer.hpp>
0031 #include <boost/type_traits/is_reference.hpp>
0032 #include <boost/type_traits/is_same.hpp>
0033
0034 #include <boost/variant/recursive_wrapper.hpp>
0035
0036 namespace boost {
0037 namespace detail { namespace variant {
0038
0039 # define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(T,Dest,Source) \
0040 substitute< T , Dest , Source > \
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 template <typename T, typename RecursiveVariant, typename NoWrapper>
0051 struct enable_recursive
0052 : BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(
0053 T, RecursiveVariant, ::boost::recursive_variant_
0054 )
0055 {
0056 };
0057
0058 template <typename T, typename RecursiveVariant>
0059 struct enable_recursive< T,RecursiveVariant,mpl::false_ >
0060 {
0061 private:
0062
0063 typedef typename BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(
0064 T, RecursiveVariant, ::boost::recursive_variant_
0065 )::type t_;
0066
0067 public:
0068
0069
0070 typedef typename mpl::if_<
0071 mpl::or_<
0072 is_same< t_,T >
0073 , is_reference<t_>
0074 , is_pointer<t_>
0075 >
0076 , t_
0077 , boost::recursive_wrapper<t_>
0078 >::type type;
0079
0080 };
0081
0082
0083
0084
0085
0086
0087
0088 template <typename RecursiveVariant, typename NoWrapper>
0089 struct quoted_enable_recursive
0090 {
0091 template <typename T>
0092 struct apply
0093 : enable_recursive<T, RecursiveVariant, NoWrapper>
0094 {
0095 };
0096 };
0097
0098 }}
0099 }
0100
0101 #endif