The [accepted] standards paper N4280 adds several new non-member functions to be folded into C++17.
There are remarks indicating the proper return values for each of the new non-member functions, and in particular, the
std::empty overload for fixed-size arrays confuses me. The paper suggests that the return value for that overload will always be
false; that all fixed-sized arrays will never be empty.
Why would this be the case? To my knowledge it is possible (though perhaps useless) to have a zero-sized array, as in
int x;, which I would call empty.
For reference, the particular overload I speak of is:
template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;
It will always return false simply because arrays can't be declared to contain zero elements. From the C++11 standard (I don't have a more recent standard handy and I don't expect this will have changed anyway):
In a declaration
Dhas the form
... If the constant-expression is present, it shall be an integral constant expression and its value shall be greater than zero. - §8.3.4 [dcl.array]
Therefore this overload would always return true in a conforming implementation.