Directly set Approx's members in operator()

This avoids instantiating the member-setting function template
and checking the invariants in cases where we know the invariant
already holds.
This commit is contained in:
Martin Hořeňovský 2018-09-03 10:20:58 +02:00
parent 84fa76e985
commit ef9150fe6f

View File

@ -35,9 +35,9 @@ namespace Detail {
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator()( T const& value ) { Approx operator()( T const& value ) {
Approx approx( static_cast<double>(value) ); Approx approx( static_cast<double>(value) );
approx.epsilon( m_epsilon ); approx.m_epsilon = m_epsilon;
approx.margin( m_margin ); approx.m_margin = m_margin;
approx.scale( m_scale ); approx.m_scale = m_scale;
return approx; return approx;
} }