MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / Approx

Class Approx

tests/catch.hpp:2717–2815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2715namespace Detail {
2716
2717 class Approx {
2718 private:
2719 bool equalityComparisonImpl(double other) const;
2720 // Validates the new margin (margin >= 0)
2721 // out-of-line to avoid including stdexcept in the header
2722 void setMargin(double margin);
2723 // Validates the new epsilon (0 < epsilon < 1)
2724 // out-of-line to avoid including stdexcept in the header
2725 void setEpsilon(double epsilon);
2726
2727 public:
2728 explicit Approx ( double value );
2729
2730 static Approx custom();
2731
2732 Approx operator-() const;
2733
2734 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2735 Approx operator()( T const& value ) {
2736 Approx approx( static_cast<double>(value) );
2737 approx.m_epsilon = m_epsilon;
2738 approx.m_margin = m_margin;
2739 approx.m_scale = m_scale;
2740 return approx;
2741 }
2742
2743 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2744 explicit Approx( T const& value ): Approx(static_cast<double>(value))
2745 {}
2746
2747 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2748 friend bool operator == ( const T& lhs, Approx const& rhs ) {
2749 auto lhs_v = static_cast<double>(lhs);
2750 return rhs.equalityComparisonImpl(lhs_v);
2751 }
2752
2753 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2754 friend bool operator == ( Approx const& lhs, const T& rhs ) {
2755 return operator==( rhs, lhs );
2756 }
2757
2758 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2759 friend bool operator != ( T const& lhs, Approx const& rhs ) {
2760 return !operator==( lhs, rhs );
2761 }
2762
2763 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2764 friend bool operator != ( Approx const& lhs, T const& rhs ) {
2765 return !operator==( rhs, lhs );
2766 }
2767
2768 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2769 friend bool operator <= ( T const& lhs, Approx const& rhs ) {
2770 return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
2771 }
2772
2773 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
2774 friend bool operator <= ( Approx const& lhs, T const& rhs ) {

Callers 2

customMethod · 0.85
operator "" _aFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected