1 /*=============================================================================
2 Copyright (c) 2001-2011 Hartmut Kaiser
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_SPIRIT_HAS_SEMANTIC_ACTION_SEP_20_2009_0626PM)
8 #define BOOST_SPIRIT_HAS_SEMANTIC_ACTION_SEP_20_2009_0626PM
14 #include <boost/mpl/bool.hpp>
15 #include <boost/mpl/or.hpp>
16 #include <boost/mpl/not.hpp>
17 #include <boost/mpl/find_if.hpp>
18 #include <boost/type_traits/is_same.hpp>
20 namespace boost { namespace spirit { namespace traits
22 // finding out, whether a component contains a semantic action
23 template <typename T, typename Enable = void>
24 struct has_semantic_action
27 template <typename Subject>
28 struct unary_has_semantic_action
29 : has_semantic_action<Subject> {};
31 template <typename Left, typename Right>
32 struct binary_has_semantic_action
33 : mpl::or_<has_semantic_action<Left>, has_semantic_action<Right> > {};
35 template <typename Elements>
36 struct nary_has_semantic_action
39 typename mpl::find_if<
40 Elements, has_semantic_action<mpl::_>
42 , typename mpl::end<Elements>::type