C++ Logo


Advanced search

Re: Two small utility functions - as_signed, as_unsigned

From: Pavel Vazharov <freakpv_at_[hidden]>
Date: Wed, 13 Oct 2021 08:03:09 +0300
I agree, the use case that I show is not very compelling one. I know about
std::size and std::ssize and yes, they can be used in this case.
That's why I asked if the people see usefulness in these functions and do
they think they belong to the standard.
So, far it seems that they are not needed and I'm not going to try and
write a proposal for them.

On Tue, Oct 12, 2021 at 10:01 PM Olaf van der Spek <ml_at_[hidden]> wrote:

> On Sat, Oct 9, 2021 at 6:36 AM Pavel Vazharov via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > The thing is that the std::container::size() functions return an
> unsigned type but we often deal with signed types along with them and the
> compilers complain about comparison between these types when warnings are
> enabled. Such functions are useful in these situations, in my experience.
> ssize() ?
> https://en.cppreference.com/w/cpp/iterator/size
> --
> Olaf

Received on 2021-10-13 00:03:23