BigUglySpider / EmuLibs

Selection of libraries designed to be used with Emu projects. This was originally a Math library only, but has since been changed to hold all Emu libraries to enable consistency in changes to dependencies (such as EmuCore modifications).
https://biguglyspider.github.io/math
0 stars 0 forks source link

[ALL] Replace `std::enable_if[_t]` uses with `requires` clauses #72

Open BigUglySpider opened 1 year ago

BigUglySpider commented 1 year ago

SFINAE is quite outdated especially in the way it is being used as of C++20, and with 23 around the corner it's very much valid to convert fully to requires clauses instead.

This was especially brought about by the fact that Visual Studio seems to struggle with enable_if statements sometimes and produces false negatives (sometimes only in part of the chain where the exact same function is called to receive the boolean along 2 layers, such as Quaternion::to_euler_constexpr evaluating a true for its enable_if but the underlying quaternion_to_euler_constexpr evaluating an incorrect false for the exact same condition function with no differences to arguments. These issues are not present when compiling with g++ under Ubuntu.

Not a large priority as it's a compiler-specific issue for something that does work and is well-formed, only MSVC seems to struggle with it. However, even then it is reasonable to modernise the code-base to allow some greater extensibility in the future (SFINAE triggers are notoriously quite laborious to work around compared to requires constraints.