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     Copyright (c) 2013 Agustin Berge
0004     http://spirit.sourceforge.net/
0005 
0006     Distributed under the Boost Software License, Version 1.0. (See accompanying
0007     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #if !defined(BOOST_SPIRIT_X3_HAS_ATTRIBUTE_JUN_6_2012_1714PM)
0010 #define BOOST_SPIRIT_X3_HAS_ATTRIBUTE_JUN_6_2012_1714PM
0011 
0012 #include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
0013 #include <boost/spirit/home/x3/support/utility/sfinae.hpp>
0014 #include <boost/mpl/bool.hpp>
0015 #include <boost/mpl/not.hpp>
0016 #include <boost/type_traits/is_same.hpp>
0017 #include <boost/utility/enable_if.hpp>
0018 
0019 namespace boost { namespace spirit { namespace x3
0020 {
0021    struct unused_type;
0022 }}}
0023 
0024 namespace boost { namespace spirit { namespace x3 { namespace traits
0025 {
0026     ///////////////////////////////////////////////////////////////////////////
0027     // Whether a component has an attribute. By default, this compares the 
0028     // component attribute against unused_type. If the component provides a
0029     // nested constant expression has_attribute as a hint, that value is used
0030     // instead. Components may specialize this.
0031     ///////////////////////////////////////////////////////////////////////////
0032     template <typename Component, typename Context, typename Enable = void>
0033     struct has_attribute;
0034     
0035     namespace detail
0036     {
0037         template <typename Component, typename Context, typename Enable = void>
0038         struct default_has_attribute
0039           : mpl::not_<is_same<unused_type,
0040                 typename attribute_of<Component, Context>::type>> {};
0041 
0042         template <typename Component, typename Context>
0043         struct default_has_attribute<Component, Context,
0044             typename disable_if_substitution_failure<
0045                 mpl::bool_<Component::has_attribute>>::type>
0046           : mpl::bool_<Component::has_attribute> {};
0047     
0048         template <typename Component, typename Context>
0049         struct default_has_attribute<Component, Context,
0050             typename enable_if_c<Component::is_pass_through_unary>::type>
0051           : has_attribute<typename Component::subject_type, Context> {};
0052     }
0053     
0054     template <typename Component, typename Context, typename Enable>
0055     struct has_attribute : detail::default_has_attribute<Component, Context> {};
0056 
0057 }}}}
0058 
0059 #endif