-
Notifications
You must be signed in to change notification settings - Fork 401
replace C-style pointer cast type deduction by 'std::declval<>()' #572
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
Conversation
... previous version does not compile on more modern Linux OSes
see also [C++ Core Guidelines - T.43]( http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using) N.B. this should make later refactoring (and possible introduction of 'concepts') a bit easier ...
attempt to trigger a build for this pr
@RalphSteinhagen , @kirkshoop So, Is C++17 minimum standard version of this project now? |
@guhwanbae - no, I do not intend rxcpp to drop cpp14 support yet. Did I merge something that requires c++17? |
@kirkshoop , Yes, |
@guhwanbae @kirkshoop I am terribly sorry. It was not my intention to implicitly boost to C++17. Since this is a very simple alias definition and in order to move forward, one could The first is a bit dirty if RxCpp is targeted to remain at C++14 compatibility for the foreseeable future, and the second -- well a bit verbose. @kirkshoop In any case, I'd be happy to make a PR to address this issue either way... just let me know your preference. |
No worries. I was also trusting the ci to cetch these types of issues. I would prefer a local definition of rxcpp::is_same_v with a check for the std version macro for std::is_same_v. If the library has it alias it, if it does not, define it. I would also like to have the ci enforcement strengthened so that it catches these things. Thanks! |
First of all: thanks for RxCpp and the great work you put into it!
It's a really neat and useful library and I wonder why it isn't already part of the C++ standard! 👍
This PR primarily addresses issue #570 and replaces pointer-type casting which causes warnings and (w/
-Werror
) errors on newer compilers.While refactoring, I noticed that some structures appear rather old (pre C++11) and could be simplified which I hope may help readability, modernizing towards C++20 (if this isn't excluded), and help new developers. Some of the low-hanging fruits (w/o breaking the apparent <=C++14 constraint) were:
N.B. this should make later refactoring (and possible introduction of 'concepts') a bit easier ...
std::is_same<...>::value
bystd::is_same_v<...>
std::conditional<...>::type
bystd::conditional_t<...>
I didn't tackle the ubiquitous
std::enable_if<...>::type
bystd::enable_if_t<...>
simplification and swapping of confusing ternary statements because of the sheer number of lines that would be impacted and because many of these lines wouldn't probably be needed anymore if this library would adopt C++20 and concepts (see also C++ Core Guidelines - T.48).Let me know what you think and hope this fits the coding standard and style this library aims for.