This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

3207. N in ssize(const T (&)[N]) should be size_t

Section: 25.7 [iterator.range] Status: NAD Submitter: Nevin Liber Opened: 2019-05-23 Last modified: 2020-11-15

Priority: Not Prioritized

View other active issues in [iterator.range].

View all other issues in [iterator.range].

View all issues with NAD status.


The N in ssize(const T (&)[N]) is specified to be of type ptrdiff_t. It should be size_t to be consistent with the rest of the standard library, such as the array overloads for all other range access functions, the swap overload for arrays, and other function template overloads for arrays. (Note: the return type of this function should still be ptrdiff_t.)

[2019-06-12 Tentatively NAD after reflector discussion]

[2020-11-09 Status changed: Tentatively NAD → NAD.]

Proposed resolution:

This wording is relative to N4810.

  1. Modify 25.7 [iterator.range] as indicated:

    template<class T, ptrdiffsize_t N> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept;

    -19- Returns: static_cast<ptrdiff_t>(N).