66fd9c367d
This is based on (cribbed almost directly from) code written by the inimitable @StephanTLavavej on one of our mailing lists. This is a nice generic version of the approach used in JsonUtils::EnumMapper and CodepointWidthDetector: a static array of key-value pairs that we binary-search at runtime (or at compile time, as the case may be.) Keys are not required to be sorted, as we're taking advantage of constexpr std::sort (VS 16.6+) to get the compiler to do it for us. How cool is that? static_map presents an operator[] or at much like std::map/std::unordered_map does. I've added some tests, but they're practically fully-solveable at compile time so they pretty much act like `VERIFY_IS_TRUE(true)`. |
||
---|---|---|
.. | ||
ut_til | ||
dirs | ||
precomp.cpp | ||
precomp.h |