File indexing completed on 2025-01-31 10:02:38
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_X3_VARIANT_HAS_SUBSTITUTE_APR_18_2014_925AM)
0009 #define BOOST_SPIRIT_X3_VARIANT_HAS_SUBSTITUTE_APR_18_2014_925AM
0010
0011 #include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
0012 #include <boost/mpl/find.hpp>
0013
0014 namespace boost { namespace spirit { namespace x3 { namespace traits
0015 {
0016 template <typename Variant, typename T>
0017 struct variant_has_substitute_impl
0018 {
0019
0020
0021
0022 typedef Variant variant_type;
0023 typedef typename variant_type::types types;
0024 typedef typename mpl::end<types>::type end;
0025
0026 typedef typename mpl::find<types, T>::type iter_1;
0027
0028 typedef typename
0029 mpl::eval_if<
0030 is_same<iter_1, end>,
0031 mpl::find_if<types, traits::is_substitute<T, mpl::_1>>,
0032 mpl::identity<iter_1>
0033 >::type
0034 iter;
0035
0036 typedef mpl::not_<is_same<iter, end>> type;
0037 };
0038
0039 template <typename Variant, typename T>
0040 struct variant_has_substitute
0041 : variant_has_substitute_impl<Variant, T>::type {};
0042
0043 template <typename T>
0044 struct variant_has_substitute<unused_type, T> : mpl::true_ {};
0045
0046 template <typename T>
0047 struct variant_has_substitute<unused_type const, T> : mpl::true_ {};
0048
0049 }}}}
0050
0051 #endif