Are these member functions as useless as they seem and exist just to provide consistency with other containers?
For example:
std::array<int, 4> array1; // size of 4 (but no elements initialized)
std::array<int, 0> array2; // size of zero.
array1.empty(); // false - not empty even though no elements are initialized
array2.empty(); // true - empty and no way to add elements
array1.size(); // room for four now
array1.max_size(); // room for four forever
array2.size(); // no room for anything now
array2.max_size(); // ... or ever
The answer to "Why is std::array< T, 0 > not empty?" deals with a zero "size" param and a non-zero return from sizeof()
, i.e., it does take up space even when empty. But that is not what I am asking.