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_ATTRIBUTE_OF_JAN_7_2012_0914AM)
0010 #define BOOST_SPIRIT_X3_ATTRIBUTE_OF_JAN_7_2012_0914AM
0011 
0012 #include <boost/spirit/home/x3/support/utility/sfinae.hpp>
0013 #include <boost/mpl/identity.hpp>
0014 #include <boost/utility/enable_if.hpp>
0015 
0016 namespace boost { namespace spirit { namespace x3 { namespace traits
0017 {
0018     ///////////////////////////////////////////////////////////////////////////
0019     // Get the attribute type of a component. By default, this gets the
0020     // Component's attribute_type typedef or instantiates a nested attribute
0021     // metafunction. Components may specialize this if such an attribute_type
0022     // is not readily available (e.g. expensive to compute at compile time).
0023     ///////////////////////////////////////////////////////////////////////////
0024     template <typename Component, typename Context, typename Enable = void>
0025     struct attribute_of;
0026 
0027     namespace detail
0028     {
0029         template <typename Component, typename Context, typename Enable = void>
0030         struct default_attribute_of;
0031 
0032         template <typename Component, typename Context>
0033         struct default_attribute_of<Component, Context,
0034             typename disable_if_substitution_failure<
0035                 typename Component::attribute_type>::type>
0036           : mpl::identity<typename Component::attribute_type> {};
0037 
0038         template <typename Component, typename Context>
0039         struct default_attribute_of<Component, Context,
0040             typename disable_if_substitution_failure<
0041                 typename Component::template attribute<Context>::type>::type>
0042           : Component::template attribute<Context> {};
0043 
0044         template <typename Component, typename Context>
0045         struct default_attribute_of<Component, Context,
0046             typename enable_if_c<Component::is_pass_through_unary>::type>
0047           : attribute_of<typename Component::subject_type, Context>{};
0048     }
0049 
0050     template <typename Component, typename Context, typename Enable>
0051     struct attribute_of : detail::default_attribute_of<Component, Context> {};
0052 }}}}
0053 
0054 #endif