Repository navigation
Feature | cpp20 compatibility - #46
Conversation
BenLeadbetter
commented
Nov 5, 2025
- Can be configured with a custom C++ standard
- The tests compile and pass against C++20
* can be configured with a custom C++ standard * the tests compile and pass against C++20
|
|
||
| struct deterministic_engine | ||
| { | ||
| using result_type = std::uint64_t; |
There was a problem hiding this comment.
I hit a compile error in a custom compilation environment (not the dev nix env) here when it seems that this result type alias is expected for the rng to conform with UniformRandomBitGenerator
arximboldi
left a comment
There was a problem hiding this comment.
Overall LGTM. Thank you for picking this up! There is a question about one of the changes.
| #if __cplusplus < 202002L | ||
| friend bool operator!=(const DerivedT& lhs, const DerivedT& rhs) | ||
| { | ||
| return !access_t::equal(derived(), rhs); | ||
| return !access_t::equal(lhs, rhs); | ||
| } | ||
| #endif |
There was a problem hiding this comment.
In C++20 operator!= is automatically generated by the compiler when there's a corresponding operator==.
It's not strictly necessary to compile it out in C++20 builds. I guess it's a tradeoff in complexity: cpp20 builds would technically need to compile less code but at the price of this compile time switch.
I'd leave it up to you of course! Let me know and I'll remove the ifdefs
| #if __cplusplus >= 201703L | ||
| empty_reductor<std::decay_t<std::invoke_result_t<XformT, step_t>>, state_t>; | ||
| #else | ||
| empty_reductor<std::decay_t<std::result_of_t<XformT(step_t)>>, state_t>; |
There was a problem hiding this comment.
std::result_of was deprecated in C++17 and removed in C++20.
std::result_of was deprecated in C++17 and removed in C++20.
9f3ccd1 to
035a352
Compare