Hacker News new | ask | show | jobs
by mr_00ff00 1168 days ago
Could you not put a series of steps or something that mocks time into constexpr? A comment mentioned above that in C++20, almost all features are available at compile time now.
1 comments

With few limitations, yes. In C++20, you could for example test for constant evaluation[1], using that as a mechanism to fall back to a real clock during runtime.

[1]: https://en.cppreference.com/w/cpp/types/is_constant_evaluate...