The new static constexpr std::integral_constant idiom

The size of std::array<T, N> is known at compile-time given the type. Yet it only provides a regular .size() member function:

template <typename T, std::size_t N>
struct array {
    constexpr std::size_t size() const {
        return N;
    }
};

This is annoying if you’re writing generic code that expects some sort of compile-time sized range.

Read this blog post at think-cell's developer blog. Subscribe there to stay up-to-date!