]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================== |
2 | Copyright (c) 2005-2010 Joel de Guzman | |
3 | Copyright (c) 2010 Thomas Heller | |
4 | ||
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_VISIT_EACH_HPP | |
9 | #define BOOST_PHOENIX_CORE_VISIT_EACH_HPP | |
10 | ||
11 | #include <boost/phoenix/core/limits.hpp> | |
12 | #include <boost/fusion/algorithm/iteration/for_each.hpp> | |
13 | #include <boost/visit_each.hpp> | |
14 | ||
15 | namespace boost { namespace phoenix | |
16 | { | |
17 | template <typename> struct actor; | |
18 | ||
19 | namespace detail | |
20 | { | |
21 | template <typename Visitor> | |
22 | struct visit_each_impl | |
23 | { | |
24 | Visitor& visitor; | |
25 | visit_each_impl(Visitor& visitor_ ) : visitor(visitor_) {} | |
26 | ||
27 | template <typename T> | |
28 | void operator()(T const& t) const | |
29 | { | |
30 | using boost::visit_each; | |
31 | visit_each(visitor, t); | |
32 | } | |
33 | }; | |
34 | } | |
35 | ||
36 | template <typename Visitor, typename Expr> | |
37 | inline void visit_each(Visitor& visitor, actor<Expr> const& a, long) | |
38 | { | |
39 | fusion::for_each(a, detail::visit_each_impl<Visitor>(visitor)); | |
40 | } | |
41 | ||
42 | template <typename Visitor, typename Expr> | |
43 | inline void visit_each(Visitor& visitor, actor<Expr> const& a) | |
44 | { | |
45 | fusion::for_each(a, detail::visit_each_impl<Visitor>(visitor)); | |
46 | } | |
47 | }} | |
48 | ||
49 | #endif |