math
math copied to clipboard
Remove `stan::math::forward_as`, prefer `if constexpr`
Now that we're requiring C++17, cleaning up these forward_as workarounds throughout the codebase would be nice.
This is also described in the Stan Math Developer docs:
If we used C++17, the above would become
T_partials_return cdf(1.0); if constexpr (is_vector<T_y>::value || is_vector<T_inv_scale>::value) { cdf = one_m_exp.prod(); } else { cdf = one_m_exp; }Where if constexpr is run before any tests are done to verify the code can be compiled.
Originally posted by @andrjohns in #3189