3 ms·
IMO this kind of lookup table is best computed externally, e.g. by a python script, and included as a literal `constexpr std::array` or something. I was recent
by pianoben 8y ago
IMO this kind of lookup table is best computed externally, e.g. by a python script, and included as a literal `constexpr std::array` or something. I was recently trying to do something very similar with constexpr lookups, and threw in the towel due to different compilers having different levels of constexpr support. With literal tables, you know exactly what's going to happen.
Constexpr has tons of promise, but the compiler support just isn't there yet - we still have to think really hard about it and look at the generated code to verify.
- beached_whale 8y agoWhat version of c++? Sounds like you are mixing 11 and 14+
- pianoben 8y agoc++14. I hit limits in clang relating to the depth of computation it will perform at compile-time, and those limits differ from gcc's and msvc's, so I switched. What do you mean by "mixing 11 and 14"?
- beached_whale 8y agoIt sounded kind of like the differences in constexpr between 11 and 14 where 11 only allowed a single statement type thing. Some people have used trampoline techniques to get around the depth limits. CRTP just did this for compile time regex.