Debian Codegraph @

packages/stokhos/src/sacado/kokkos/Stokhos_mpl_for_each.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef STOKHOS_MPL_FOR_EACH_HPP
11 #define STOKHOS_MPL_FOR_EACH_HPP
12
13 #include "Sacado_mpl_begin.hpp"
14 #include "Sacado_mpl_end.hpp"
15 #include "Sacado_mpl_next.hpp"
16 #include "Sacado_mpl_deref.hpp"
17
18 #include "Kokkos_Macros.hpp"
19
20 namespace Stokhos {
21
22 namespace mpl {
23
24 template <class Seq,
25 class Iter1 = typename Sacado::mpl::begin<Seq>::type,
26 class Iter2 = typename Sacado::mpl::end<Seq>::type>
27 struct for_each {
28 template <typename Op>
29 KOKKOS_INLINE_FUNCTION
30 for_each(const Op& op) {
31 op(typename Sacado::mpl::deref<Iter1>::type());
32 for_each<Seq, typename Sacado::mpl::next<Iter1>::type, Iter2> f(op);
33 }
34 };
35
36 template <class Seq, class Iter1>
37 struct for_each<Seq, Iter1, Iter1> {
38 template <typename Op>
39 KOKKOS_INLINE_FUNCTION
40 for_each(const Op& op) {}
41 };
42
43 }
44
45 }
46
47 #endif // STOKHOS_MPL_FOR_EACH_HPP