![]() |
STD-DISCUSSION |
Subject: Re: Rationale for return type of the non-array version of std::ssize()
From: Bo Persson (bo_at_[hidden])
Date: 2020-04-28 06:42:40
On 2020-04-28 at 12:46, Gennaro Prota via Std-Discussion wrote:
> Hi All,
>
> what is the reason why the non-array version of std::ssize() returns
>
> std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(c.size())>>
>
> rather than just
>
> std::ptrdiff_t
>
> ?
>
> Thanks a lot.
>
The containers size_type is not required to be convertible to ptrdiff_t.
This will try to find some other type in that case.
Bo Persson
STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org