No class template specialization for array of bool?
This is a question about history of evolution of C++. In hindsight a possible explanation is:
std::vector<bool> was a mistake. It is a major annoyance that a
std::vector<bool> is very different from
std::vector<T>. Generic code that works with
vectors often needs a special case for
std::vector<bool>. And users often have to apply weird workarounds like using a
std::vector<char> in place of
std::vector<bool>. Now we cannot go back without breaking lots of existing code. With what we know now, maybe
std::vector<bool> would never have made it into C++.
std::array was added only in C++11. There was no reason to make the same mistake again.
std::vector was introduced, a specialization for
bool was considered a good idea. Basically, at that time, the average computer had 4 MB of memory, so saving computer memory was quite important. Nowadays we just say "memory is cheap" (quote from Uncle Bob).
Later it turned out that this specialization creates more problems than it is worth.
The issue is that the address to one of the elements of such a vector is a complex object (it has to store information on which bit holds which value) compared to regular old-fashioned C-array
Since compatibility must be retained, this specialization can't be dropped, but based on that lesson, the same approach was not applied to
Another reason is that
std::array is supposed to be a C-array wrapper, so it must be as similar to
bool a[N] as possible, and must produce the same machine code when used.
And the last thing, as Cody Gray points out in a comment under question,
std::bitset is a constant size array of bits, so such functionality is already available (and can be used if needed).