1 /*=============================================================================
2     Copyright (c) 2001-2007 Joel de Guzman
3     Copyright (c) 2007 Dan Marsden
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 #if !defined(BOOST_FUSION_FOR_EACH_20070527_0943)
9 #define BOOST_FUSION_FOR_EACH_20070527_0943
10 
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/algorithm/iteration/detail/for_each.hpp>
13 #include <boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp>
14 #include <boost/fusion/support/is_segmented.hpp>
15 #include <boost/fusion/support/is_sequence.hpp>
16 #include <boost/utility/enable_if.hpp>
17 
18 namespace boost { namespace fusion
19 {
20     namespace result_of
21     {
22         template <typename Sequence, typename F>
23         struct for_each
24         {
25             typedef void type;
26         };
27     }
28 
29     template <typename Sequence, typename F>
30     BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
31     inline typename
32         enable_if<
33             traits::is_sequence<Sequence>
34           , void
35         >::type
for_each(Sequence & seq,F const & f)36     for_each(Sequence& seq, F const& f)
37     {
38         detail::for_each(seq, f, typename traits::is_segmented<Sequence>::type());
39     }
40 
41     template <typename Sequence, typename F>
42     BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
43     inline typename
44         enable_if<
45             traits::is_sequence<Sequence>
46           , void
47         >::type
for_each(Sequence const & seq,F const & f)48     for_each(Sequence const& seq, F const& f)
49     {
50         detail::for_each(seq, f, typename traits::is_segmented<Sequence>::type());
51     }
52 }}
53 
54 #endif
55