-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for comparison with strong typedefs #658
Conversation
Thanks for this. |
Sounds good to me. Do you have existing examples I can base an improved PR upon? |
a164579
to
22370db
Compare
I'm not quite sure what you mean by existing examples. Specific to Anyway, we happened to meet at lunch today (small world!) and you also mentioned that you wanted an overload of |
I've updated the PR so tests pass. I wondered if you had existing macros to deal with conditional c++ 11 support |
Are further changes to this PR required? |
Are further changes needed to merge this? I've been using my patched version of Catch without any issues for a few months now. |
@@ -40,7 +44,19 @@ namespace Detail { | |||
approx.scale( m_scale ); | |||
return approx; | |||
} | |||
#if defined(__cplusplus) && __cplusplus >= 201103L | |||
template <typename T, typename = typename std::enable_if<std::is_constructible<T, double>::value>::type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is enabled when T
is constructible from double
. But you actually do the inverse below. Should use std::is_constructible<double, T>
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted. Fixed.
e0f7964
to
d3f930a
Compare
test failures are addressed by #716 and are unconnected with this change. |
Sorry I've been quiet on this. I'm gradually getting up to speed again now! From my initial quick scan this looks good (with @lightmare's fix) but I now see what you mean about the conditional C++ macros. Catch |
e1356fe
to
5a1c152
Compare
@@ -44,7 +44,7 @@ namespace Detail { | |||
approx.scale( m_scale ); | |||
return approx; | |||
} | |||
#if defined(__cplusplus) && __cplusplus >= 201103L | |||
#if CATCH_CPP11_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use #ifdef
, it doesn't have a value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not "Why you should prefer #ifs over #ifdefs" (somewhat past halfway) 💎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amended.
I'll push support for != too. Seems silly to leave this out. |
e421a85
to
5daacb7
Compare
Squashed into one commit and ready to go. |
5daacb7
to
5a9072d
Compare
I've rebased this again to handle the incorporation of <= and >= operators. |
This is now in master, I added a new feature toggle so that MSVC can use this as well (it still doesn't trigger the C++11 feature check). |
closes #652