C++ Logo

std-proposals

Advanced search

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

From: Howard Hinnant <howard.hinnant_at_[hidden]>
Date: Sat, 12 Apr 2025 13:07:32 -0400
Ancedote:

std::integral recently fell out of favor with me and I wrote my own concept that better suited my needs:

https://github.com/HowardHinnant/bbi/blob/master/bbi.h#L176-L191

StandardSignedInteger
StandardUnsignedInteger
StandardInteger

The difference here is that my concepts exclue bool and the character types. This distinction was at best not clear in C++11, and not modeled by the type_traits introduced then. For my work today, it is important to not include bool and the character types as “integral types” as their semantics are not consistent with the representaiton of integral numbers.

I mention this ancedote as a word of caution for building further concepts on top of type_traits. type_traits was a good model of the type system when they were introduced, but may not be today, 15 years later.

Howard

Received on 2025-04-12 17:08:04