C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 16 Apr 2025 10:15:10 +0100
On Tue, Apr 15, 2025 at 5:41 PM Jason McKesson wrote:
>
> If you want your concept to be extensible, for types to explicitly
> opt-in, you can.


I think you're talking about tags.

class MyClass {
public:
    typedef int IsArithmetic;
};

And I think maybe tags should be standardised, the default behaviour
being that a tag is inherited by derived classes unless you mark it
"final" as follows:

class MyClass {
public:
    _Tag IsArithmetic : final; // This one is not inherited by derived classes
    _Tag IsNuclear; // This one is inherited by derived classes
};

Received on 2025-04-16 09:15:23