C++ Logo

std-discussion

Advanced search

Re: Extended overflow arithmetic library

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Fri, 19 Jan 2024 01:09:06 +0100
Il 18/01/24 23:32, Tiago Freire via Std-Discussion ha scritto:
> Hi everyone,
>
> I would like to submit a draft paper related to the introduction of
> functions in the <numeric> library related to overflow arithmetic in the
> same spirit of the “saturated” function family.
>
> Feedback is appreciated; you can have an early read of the text here:
> https://kaotic.software/cpp_papers/overflow_arithmetic.html
> <https://kaotic.software/cpp_papers/overflow_arithmetic.html>

I don't understanding the "bashing" over the saturation functions.
The paper goes for some easy irony:

> If only there was a way to define in the template parameters which overloaded types were allowed? Oh, wait there is! It is called concepts, and it has been introduced in C++20, we should use that.

Guess what? All the saturating function templates are already
constrained on T being integral:

https://eel.is/c++draft/numeric.sat


My 2 c,

-- 
Giuseppe D'Angelo

Received on 2024-01-19 00:09:10