C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::arithmetic (concept)

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Sat, 12 Apr 2025 09:32:28 +0100
On Sat, 12 Apr 2025, 06:41 Tymi via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> Seems like that concept is missing, I would like to have it. We already
> have std::integral anyway... And std::is_arithmetic...
>

The concepts that are in the library were added because there is a specific
use case for them in the library. We didn't add concepts speculatively
because they might be useful, or just because there's a type trait. So
there's no arithmetic concept because there was no use for it.



> Possible implementation:
> ```cpp
> template <typename T>
> concept arithmetic = is_arithmetic_v<T>;
> ```
>

You can define this yourself, or you can just use is_arithmetic_v in
constraints.

Yeah it would be zero WG21 work and little SG work I guess..
>

That's unlikely.

>

Received on 2025-04-12 08:32:46