3 ms·
I personally quite like templates and constexpr. I don’t do anything too crazy with them, but I like being able to write code that will compile down to efficien
by dkersten 2y ago
I personally quite like templates and constexpr. I don’t do anything too crazy with them, but I like being able to write code that will compile down to efficient code without runtime checks. I tried to write equally generic code in typescript recently and I had to make peace with the fact that I had to pay for either an indirect call through inheritance or a runtime conditional, where in C++ I could use template code and a constexpr if to choose the correct code path at compile time.