vendredi 1 avril 2022

What's the use of

The <ratio> header lets you uses template meta-programming to work with and manipulate rational values.

However - it was introduced in C++11, when we already had constexpr. Why is it not good enough to have a fully-constexpr'ifed library type for rationals over type I, and use that instead?

Is there some concrete benefit to using std::ratio that C++11 constexpr functionality would not be well-suited enough for? And if so, is it still relevant in C++20 (with the expanded "reach" of constexpr)?

Aucun commentaire:

Enregistrer un commentaire