diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp index 85f12de7..7e9d57d0 100644 --- a/include/internal/catch_evaluate.hpp +++ b/include/internal/catch_evaluate.hpp @@ -69,18 +69,21 @@ namespace Internal { return const_cast( lhs ) <= const_cast( rhs ); } }; - + template bool applyEvaluator( const T1& lhs, const T2& rhs ) { return Evaluator::evaluate( lhs, rhs ); } - + + // This level of indirection allows us to specialise for integer types + // to avoid signed/ unsigned warnings + // "base" overload template bool compare( const T1& lhs, const T2& rhs ) { return Evaluator::evaluate( lhs, rhs ); } - + // unsigned X to int template bool compare( unsigned int lhs, int rhs ) { return applyEvaluator( lhs, static_cast( rhs ) ); @@ -126,44 +129,18 @@ namespace Internal { } // pointer to long (when comparing against NULL) - template - bool compare( long lhs, const T* rhs ) { - return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); - } - - template - bool compare( long lhs, T* rhs ) { + template bool compare( long lhs, T* rhs ) { return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); } - - template - bool compare( const T* lhs, long rhs ) { - return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); - } - - template - bool compare( T* lhs, long rhs ) { + template bool compare( T* lhs, long rhs ) { return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); } // pointer to int (when comparing against NULL) - template - bool compare( int lhs, const T* rhs ) { - return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); - } - - template - bool compare( int lhs, T* rhs ) { + template bool compare( int lhs, T* rhs ) { return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); } - - template - bool compare( const T* lhs, int rhs ) { - return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); - } - - template - bool compare( T* lhs, int rhs ) { + template bool compare( T* lhs, int rhs ) { return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); } diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 572c8c37..5804d787 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -22,7 +22,7 @@ class ExpressionLhs { void operator = ( const ExpressionLhs& ); public: - ExpressionLhs( T lhs ) : m_lhs( lhs ) {} + ExpressionLhs( const T& lhs ) : m_lhs( lhs ) {} template ExpressionResultBuilder& operator == ( const RhsT& rhs ) { diff --git a/single_include/catch.hpp b/single_include/catch.hpp index e92dc0cb..a04b2a4a 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,5 +1,5 @@ /* - * Generated: 2012-11-06 07:51:06.701955 + * Generated: 2012-11-06 19:13:05.717033 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -797,6 +797,9 @@ namespace Internal { return Evaluator::evaluate( lhs, rhs ); } + // This level of indirection allows us to specialise for integer types + // to avoid signed/ unsigned warnings + // "base" overload template bool compare( const T1& lhs, const T2& rhs ) { @@ -848,44 +851,18 @@ namespace Internal { } // pointer to long (when comparing against NULL) - template - bool compare( long lhs, const T* rhs ) { - return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); - } - - template - bool compare( long lhs, T* rhs ) { + template bool compare( long lhs, T* rhs ) { return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); } - - template - bool compare( const T* lhs, long rhs ) { - return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); - } - - template - bool compare( T* lhs, long rhs ) { + template bool compare( T* lhs, long rhs ) { return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); } // pointer to int (when comparing against NULL) - template - bool compare( int lhs, const T* rhs ) { - return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); - } - - template - bool compare( int lhs, T* rhs ) { + template bool compare( int lhs, T* rhs ) { return Evaluator::evaluate( reinterpret_cast( lhs ), rhs ); } - - template - bool compare( const T* lhs, int rhs ) { - return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); - } - - template - bool compare( T* lhs, int rhs ) { + template bool compare( T* lhs, int rhs ) { return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) ); } @@ -944,7 +921,7 @@ class ExpressionLhs { void operator = ( const ExpressionLhs& ); public: - ExpressionLhs( T lhs ) : m_lhs( lhs ) {} + ExpressionLhs( const T& lhs ) : m_lhs( lhs ) {} template ExpressionResultBuilder& operator == ( const RhsT& rhs ) {