Date: Mon, 11 May 2020 12:56:18 +0200
On Thu, Apr 30, 2020 at 2:56 AM Thiago Macieira via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> On Tuesday, 28 April 2020 09:42:17 PDT Bo Persson via Std-Discussion wrote:
> > Unless it is a wider type. It could be that ptrdiff_t is int and some
> > container's size() function returns unsigned long long. It just *could*.
>
> That is a distinct possibility if the container is not of objects in memory.
> Examples: files in the filesystem, objects in an object store database,
> database entries, etc. Or even simpler: bytes in a file.
>
> Or on some exotic platform with small size_t and ptrdiff_t.. ptrdiff_t is not
> required to work for any two arbitrary pointers, only those of one memory
> block. [...]
Thanks, and sorry for the late reply. OK, so I think the next question
is: why not just returning std::make_signed_t< decltype( c.size() ) >?
<std-discussion_at_[hidden]> wrote:
>
> On Tuesday, 28 April 2020 09:42:17 PDT Bo Persson via Std-Discussion wrote:
> > Unless it is a wider type. It could be that ptrdiff_t is int and some
> > container's size() function returns unsigned long long. It just *could*.
>
> That is a distinct possibility if the container is not of objects in memory.
> Examples: files in the filesystem, objects in an object store database,
> database entries, etc. Or even simpler: bytes in a file.
>
> Or on some exotic platform with small size_t and ptrdiff_t.. ptrdiff_t is not
> required to work for any two arbitrary pointers, only those of one memory
> block. [...]
Thanks, and sorry for the late reply. OK, so I think the next question
is: why not just returning std::make_signed_t< decltype( c.size() ) >?
-- -- .:: Gennaro Prota ::. .:: https://about.me/gennaro.prota ::.
Received on 2020-05-11 05:59:59