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[0];, 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;
Aucun commentaire:
Enregistrer un commentaire