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

◆ forward_as() [4/4]

template<typename T_desired , typename T_actual , require_all_eigen_t< T_desired, T_actual > * = nullptr, std::enable_if_t< !std::is_same< value_type_t< T_actual >, value_type_t< T_desired > >::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_desired stan::math::forward_as ( const T_actual &  a)
inline

Assume which type we get.

If actual type is not convertible to assumed type or in case of eigen types compile time rows and columns are not the same and desired sizes are not dynamic this has return type of T_desired, but it only throws. This version should only be used where it is optimized away so the throw should never happen.

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
nothing, this always throws
Exceptions
alwaysthrows std::runtime_error

Definition at line 122 of file forward_as.hpp.