Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ forward_as() [3/4]

template<typename T_desired , typename T_actual , require_eigen_t< T_desired > * = nullptr, std::enable_if_t< std::is_same< value_type_t< T_actual >, value_type_t< T_desired > >::value &&is_eigen< T_desired >::value &&is_eigen< T_actual >::value &&internal::eigen_static_size_match(T_desired::RowsAtCompileTime, std::decay_t< T_actual >::RowsAtCompileTime) &&internal::eigen_static_size_match(T_desired::ColsAtCompileTime, std::decay_t< T_actual >::ColsAtCompileTime)> * = nullptr>
T_actual && stan::math::forward_as ( T_actual &&  a)
inline

Assume which type we get.

If actual type is convertible to assumed type or in case of eigen types compile time rows and columns also match or desired sizes are dynamic this is a no-op. Otherwise it throws std::runtime_error, which should never happen if used as intended.

This is intended to be used in compile time branches that would otherwise trigger compile error even though they are never executed.

Template Parameters
T_desiredtype of output we need to avoid compile time errors
T_actualactual type of the argument
Parameters
ainput value
Returns
the input value a

Definition at line 91 of file forward_as.hpp.