3 ms·
> How do you even debug that? You provide a set of static assertions for the use cases you aren't sure of. constexpr functions should be thoroughly unit testab
by humanrebar 9y ago
> How do you even debug that?
You provide a set of static assertions for the use cases you aren't sure of. constexpr functions should be thoroughly unit testable at compile time.
If you're worried about production compile times, put the static assertions in your test code.
- 112233 9y agoAgree about unit tests. But asserts are used also to catch invalid _use_ of functions. void f(size_t x) { assert(x); // calling f with 0 is bug } constexpr f(size_t x) { ?????(x != 0); // <- what to write here? }