1#ifndef STAN_MATH_PRIM_FUNCTOR_ITER_TUPLE_N_HPP
2#define STAN_MATH_PRIM_FUNCTOR_ITER_TUPLE_N_HPP
22template <
typename F,
typename... Types>
24 constexpr bool is_vec_container
25 = (is_std_vector_v<Types> && ...)
27 if constexpr ((is_tuple_v<Types> && ...)) {
29 [&f](
auto&&... args_i) {
32 std::forward<Types>(args)...);
33 }
else if constexpr (is_vec_container) {
34 const auto vec_size =
max_size(args...);
35 for (Eigen::Index i = 0; i < vec_size; ++i) {
39 f(std::forward<Types>(args)...);
void iter_tuple_nested(F &&f, Types &&... args)
Iterate and nest into a tuple or std::vector to apply f to each matrix or scalar type.
constexpr void for_each(F &&f, const std::tuple<> &)
Apply a function to each element of a tuple.
int64_t max_size(const T1 &x1, const Ts &... xs)
Calculate the size of the largest input.
Matrices and templated mathematical functions.
Checks if decayed type is a var, fvar, or arithmetic.