3 ms·
This makes sense for straightforward tests, but static_assert is not all you need in general, because some things has be executed in runtime, after series of st
by dig1 4y ago
This makes sense for straightforward tests, but static_assert is not all you need in general, because some things has be executed in runtime, after series of steps or after some timeframe. Good luck reproducing or testing these in compile-time.
- mr_00ff00 4y agoCould 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.
- ovao 4y agoWith 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_evaluated https://en.cppreference.com/w/cpp/types/is_constant_evaluate...