1 /*==============================================================================
2 Copyright (c) 2010 Thomas Heller
3 Copyright (c) 2010 Eric Niebler
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PHOENIX_CORE_ARITY_HPP
9 #define BOOST_PHOENIX_CORE_ARITY_HPP
11 #include <boost/phoenix/core/limits.hpp>
12 #include <boost/is_placeholder.hpp>
13 #include <boost/mpl/max.hpp>
14 #include <boost/mpl/int.hpp>
15 #include <boost/phoenix/core/meta_grammar.hpp>
16 #include <boost/phoenix/core/terminal_fwd.hpp>
17 #include <boost/phoenix/support/vector.hpp>
18 #include <boost/proto/matches.hpp>
19 #include <boost/proto/transform/fold.hpp>
21 namespace boost { namespace phoenix
23 /////////////////////////////////////////////////////////////////////////////
25 // Calculate the arity of an expression using proto transforms
27 /////////////////////////////////////////////////////////////////////////////
33 template <typename Expr>
40 , boost::phoenix::arity
50 template <typename Rule, typename Dummy = void>
55 , proto::make<mpl::max<
61 functional::context(_env, _actions)
70 template <typename Dummy>
71 struct arity::when<rule::argument, Dummy>
72 : proto::make<is_placeholder<proto::_value>()>
75 template <typename Dummy>
76 struct arity::when<rule::custom_terminal, Dummy>
77 : proto::make<mpl::int_<0>()>
80 template <typename Dummy>
81 struct arity::when<rule::terminal, Dummy>
82 : proto::make<mpl::int_<0>()>