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

◆ forward_as() [1/4]

template<typename T_desired , typename T_actual , typename = std::enable_if_t<std::is_same<std::decay_t<T_actual>, std::decay_t<T_desired>>::value && !is_eigen<T_desired>::value>>
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 37 of file forward_as.hpp.