I've found the recent typescript 3x3 magic square checker entertaining. Anyway here is a arbitrary magic square checker using c++ type traits.
altc++ #include // from https://stackoverflow.com/a/8625010/12469275 // cmath’s sqrt is constexpr from c++26 constexpr std::size_t isqrt_impl (std::size_t sq, std::size_t dlt, std::size_t value){ return sq > 1) - 1; } constexpr std::size_t isqrt(std::size_t value){ return isqrt_impl(1, 3, value); } // because pack...
![](https://kbin.life/media/cache/resolve/entry_thumb/c2/86/c286c28416dfb6a79564ca9b4b56a3ae3382b42c2680ad178b99790ea40680e9.png)