1#ifndef STAN_MATH_MIX_FUNCTOR_CONDITIONAL_COPY_AND_PROMOTE_HPP
2#define STAN_MATH_MIX_FUNCTOR_CONDITIONAL_COPY_AND_PROMOTE_HPP
28template <
template <
typename...>
class Filter,
32 return map_if<Filter>(
36 [](
auto&&... inner_args) {
40 std::forward<
decltype(inner_args)>(inner_args))...);
42 std::forward<decltype(arg)>(
arg));
45 Filter, PromotedType, CopyType>(
arg[0]))>
47 for (std::size_t i = 0; i <
arg.size(); ++i) {
49 conditional_copy_and_promote<Filter, PromotedType, CopyType>(
58 if constexpr (std::is_same_v<PromotedType,
60 return std::forward<decltype(arg)>(
arg);
63 std::forward<
decltype(
arg)>(
arg)));
68 std::forward<Args>(args)...);
79template <
typename PromotedType,
typename... Args>
83 std::forward<Args>(args)...);
97template <
typename PromotedType,
typename... Args>
101 std::forward<Args>(args)...);
auto deep_copy_vargs(Args &&... args)
Conditional deep copy types with a var scalar type to PromotedType.
auto shallow_copy_vargs(Args &&... args)
Conditional shallow copy types with a var scalar type to PromotedType.
COPY_TYPE
Decide if object should be deep or shallow copied when using conditional_copy_and_promote .
auto conditional_copy_and_promote(Args &&... args)
Conditional copy and promote a type's scalar type to a PromotedType.
A comparator that works for any container type that has the brackets operator.
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
fvar< T > arg(const std::complex< fvar< T > > &z)
Return the phase angle of the complex argument.
T eval(T &&arg)
Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions ...
constexpr auto make_holder_tuple(Types &&... args)
Holds ownership of rvalues and forwards lvalues into a tuple.
constexpr bool is_tuple_v
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
typename scalar_type< T >::type scalar_type_t
constexpr bool is_std_vector_v