Skip to content

Commit c49115c

Browse files
committed
Add make_forwarding_policy and make_forwarding_policy_t
1 parent b042910 commit c49115c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/boost/math/policies/policy.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,22 @@ struct is_noexcept_error_policy
10031003
&& (t8::value != throw_on_error) && (t8::value != user_error));
10041004
};
10051005

1006+
// Generate a forwarding policy to stop further promotion from occurring
1007+
// For example if a special function for float promotes to double, we don't want the next
1008+
// function in the call chain to then promote to long double
1009+
template <typename Policy>
1010+
using make_forwarding_policy =
1011+
typename policies::normalise<
1012+
Policy,
1013+
policies::promote_float<false>,
1014+
policies::promote_double<false>,
1015+
policies::discrete_quantile<>,
1016+
policies::assert_undefined<>
1017+
>::type;
1018+
1019+
template <typename Policy>
1020+
using make_forwarding_policy_t = typename make_forwarding_policy<Policy>::type;
1021+
10061022
}}} // namespaces
10071023

10081024
#endif // BOOST_MATH_POLICY_HPP

0 commit comments

Comments
 (0)