1#ifndef STAN_MATH_PRIM_FUNCTOR_MAP_IF_HPP
2#define STAN_MATH_PRIM_FUNCTOR_MAP_IF_HPP
15template <
template <
typename...>
class Filter,
typename F,
typename Arg>
17 if constexpr (Filter<Arg>::value) {
18 return f(std::forward<Arg>(
arg));
20 return std::forward<Arg>(
arg);
40template <
template <
typename...>
class Filter,
typename F,
typename Tuple,
44 [](
auto&& f,
auto&&... args) {
46 std::forward<
decltype(f)>(f),
47 std::forward<
decltype(args)>(args))...);
49 std::forward<Tuple>(
arg), std::forward<F>(f));
66template <
template <
typename...>
class Filter,
typename F,
typename Arg1,
69inline constexpr auto map_if(F&& f, Arg1&& arg1, Args&&... args) {
71 internal::filter_fun<Filter>(f, std::forward<Arg1>(arg1)),
72 internal::filter_fun<Filter>(f, std::forward<Args>(args))...);
75template <
template <
typename...>
class Filter,
typename F,
typename Arg,
77inline constexpr decltype(
auto)
map_if(F&& f, Arg&&
arg) {
78 return internal::filter_fun<Filter>(std::forward<F>(f),
79 std::forward<Arg>(
arg));
constexpr decltype(auto) filter_fun(F &&f, Arg &&arg)
fvar< T > arg(const std::complex< fvar< T > > &z)
Return the phase angle of the complex argument.
constexpr auto make_holder_tuple(Types &&... args)
Holds ownership of rvalues and forwards lvalues into a tuple.
constexpr auto map_if(F &&f, Tuple &&arg)
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
std::enable_if_t< Check::value > require_t
If condition is true, template is enabled.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...