diff options
| author | Phil Nash | 2013-06-29 12:07:33 +0100 |
|---|---|---|
| committer | Phil Nash | 2013-06-29 12:07:33 +0100 |
| commit | 5d26ca1af7eba30eb74cb08d598d99829567d911 (patch) | |
| tree | a29cac0e51220f2cfd60950d39877dc97483a25d /include | |
| parent | a9b346b14dc187f9f4c7a3d09c564903c5df1a13 (diff) | |
| download | catch3-5d26ca1af7eba30eb74cb08d598d99829567d911.tar.gz | |
Static assertion for && and || expressions
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_expression_lhs.hpp | 4 | ||||
| -rw-r--r-- | include/internal/catch_expressionresult_builder.h | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 21cc593a..f21c4eec 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -13,8 +13,6 @@ namespace Catch { -struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; - // Wraps the LHS of an expression and captures the operator and RHS (if any) - wrapping them all // in an ExpressionResultBuilder object template<typename T> @@ -76,6 +74,8 @@ public: template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( RhsT const& ); template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( RhsT const& ); template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( RhsT const& ); + template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( RhsT const& ); + template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( RhsT const& ); private: template<Internal::Operator Op, typename RhsT> diff --git a/include/internal/catch_expressionresult_builder.h b/include/internal/catch_expressionresult_builder.h index 5bf41379..13855888 100644 --- a/include/internal/catch_expressionresult_builder.h +++ b/include/internal/catch_expressionresult_builder.h @@ -16,6 +16,8 @@ namespace Catch { +struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; + // Wraps the (stringised versions of) the lhs, operator and rhs of an expression - as well as // the result of evaluating it. This is used to build an AssertionResult object class ExpressionResultBuilder { @@ -43,6 +45,9 @@ public: AssertionResult buildResult( AssertionInfo const& info ) const; + template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( RhsT const& ); + template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( RhsT const& ); + private: AssertionResultData m_data; struct ExprComponents { |