[OT] The Usual Arithmetic Confusions
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Jan 31 09:25:19 UTC 2022
On Sunday, 30 January 2022 at 17:22:18 UTC, Ivan Kazmenko wrote:
> At least in 64-bit programs, I don't really see the benefit of
> the sizes being unsigned anymore. Even C++ has `cont.ssize()`
> now for signed size.
In C++20 they have provided a function std::ssize(container) that
will return a signed integer type. That way you can write
templates that assume regular arithmetics and that also will work
with old containers. Of course, C++ is a language where you need
to learn idioms to program well… which makes it a challenging
language to pick up. Smaller languages would be better off with
breaking changes I think.
(I don't think they have changed the existing containers?)
More information about the Digitalmars-d
mailing list