alpaka
Abstraction Library for Parallel Kernel Acceleration
Fold.hpp
Go to the documentation of this file.
1
/* Copyright 2022 Axel Huebl, Benjamin Worpitz, Jan Stephan, Bernhard Manfred Gruber
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include "
alpaka/core/Common.hpp
"
8
9
namespace
alpaka::meta
10
{
11
ALPAKA_NO_HOST_ACC_WARNING
12
template
<
typename
TFnObj,
typename
T>
13
ALPAKA_FN_HOST_ACC
constexpr
auto
foldr
(TFnObj
const
&
/* f */
, T
const
& t) -> T
14
{
15
return
t;
16
}
17
18
ALPAKA_NO_HOST_ACC_WARNING
19
template
<
typename
TFnObj,
typename
T0,
typename
T1,
typename
... Ts>
20
ALPAKA_FN_HOST_ACC
constexpr
auto
foldr
(TFnObj
const
& f, T0
const
& t0, T1
const
& t1, Ts
const
&... ts)
21
{
22
return
f(t0,
foldr
(f, t1, ts...));
23
}
24
}
// namespace alpaka::meta
Common.hpp
ALPAKA_FN_HOST_ACC
#define ALPAKA_FN_HOST_ACC
Definition:
Common.hpp:39
ALPAKA_NO_HOST_ACC_WARNING
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
Definition:
Common.hpp:82
alpaka::meta
Definition:
Apply.hpp:8
alpaka::meta::foldr
ALPAKA_NO_HOST_ACC_WARNING constexpr ALPAKA_FN_HOST_ACC auto foldr(TFnObj const &, T const &t) -> T
Definition:
Fold.hpp:13
include
alpaka
meta
Fold.hpp
Generated on Thu Nov 21 2024 22:46:15 for alpaka by
1.9.1