Skip to content

Remove stan::math::forward_as, prefer if constexpr #3190

@WardBrian

Description

@WardBrian

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions