Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:02:38

0001 /*=============================================================================
0002     Copyright (c) 2001-2014 Joel de Guzman
0003     http://spirit.sourceforge.net/
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
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         // Find a type from the Variant that can be a substitute for T.
0020         // return true_ if one is found, else false_
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