Automatic Differentiation
 
Loading...
Searching...
No Matches
index_apply.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_INDEX_APPLY_HPP
2#define STAN_MATH_PRIM_META_INDEX_APPLY_HPP
3#include <utility>
4#include <cstddef>
5
6namespace stan {
7namespace math {
8
9namespace internal {
10template <class F, std::size_t... Is>
11inline constexpr auto index_apply_impl(F&& f, std::index_sequence<Is...>) {
12 return std::forward<F>(f)(std::integral_constant<std::size_t, Is>{}...);
13}
14} // namespace internal
15
25template <std::size_t N, class F>
26inline constexpr auto index_apply(F&& f) {
27 return internal::index_apply_impl(std::forward<F>(f),
28 std::make_index_sequence<N>{});
29}
30
31} // namespace math
32} // namespace stan
33
34#endif // STAN_MATH_PRIM_META_APPLY_HPP
constexpr auto index_apply_impl(F &&f, std::index_sequence< Is... >)
constexpr auto index_apply(F &&f)
Calls given callable with an index sequence.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9