Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

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.
Commit
ef9150fe6f3c4a3b5836aac1e0cfaaeeccd28d69
Author
Martin Hořeňovský ·
Parents
84fa76e9850c

Files · Download .tar.gz

Changes

 include/internal/catch_approx.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/internal/catch_approx.h b/include/internal/catch_approx.h
index c0696307..4522e5ad 100644
--- a/include/internal/catch_approx.h
+++ b/include/internal/catch_approx.h
@@ -35,9 +35,9 @@ namespace Detail {
         template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
         Approx operator()( T const& value ) {
             Approx approx( static_cast<double>(value) );
-            approx.epsilon( m_epsilon );
-            approx.margin( m_margin );
-            approx.scale( m_scale );
+            approx.m_epsilon = m_epsilon;
+            approx.m_margin = m_margin;
+            approx.m_scale = m_scale;
             return approx;
         }