mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-02 02:03:30 +01:00
Support explicit operator bool
Fix for issue 596
This commit is contained in:
parent
3b4edd7a48
commit
776247af81
@ -52,37 +52,37 @@ namespace Internal {
|
|||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsEqualTo> {
|
struct Evaluator<T1, T2, IsEqualTo> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs) {
|
||||||
return opCast( lhs ) == opCast( rhs );
|
return bool( opCast( lhs ) == opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsNotEqualTo> {
|
struct Evaluator<T1, T2, IsNotEqualTo> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||||
return opCast( lhs ) != opCast( rhs );
|
return bool( opCast( lhs ) != opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsLessThan> {
|
struct Evaluator<T1, T2, IsLessThan> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||||
return opCast( lhs ) < opCast( rhs );
|
return bool( opCast( lhs ) < opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsGreaterThan> {
|
struct Evaluator<T1, T2, IsGreaterThan> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||||
return opCast( lhs ) > opCast( rhs );
|
return bool( opCast( lhs ) > opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
|
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||||
return opCast( lhs ) >= opCast( rhs );
|
return bool( opCast( lhs ) >= opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
|
struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
|
||||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||||
return opCast( lhs ) <= opCast( rhs );
|
return bool( opCast( lhs ) <= opCast( rhs ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user