Date: Tue, 19 Dec 2023 16:29:28 +0100
Il 19/12/23 09:12, JIMMY HU via Std-Proposals ha scritto:
> template<typenameT>
> conceptis_summable = requires(T x) { x + x; }; // one
> parameter version
>
> // error: redefinition of concept 'is_summable' with different template
> parameters or requirements
> template<typenameT>
> conceptis_summable = requires(T x, T y) { x + y; }; // two
> parameter version
These two concepts are checking... the very same thing? I'm not sure
what you are after here.
If you want something like this instead:
> template <typename T>
> concept is_summable = requires(T x) { x + x; };
>
> template <typename T, typename U>
> concept is_summable = requires(T x, U y) { x + y; };
>
This sounds more interesting, but then again, you can't redeclare any
templated entity with a different set of template arguments.
The Standard simply calls the second version of the concept `_with`.
My 2 c,
> template<typenameT>
> conceptis_summable = requires(T x) { x + x; }; // one
> parameter version
>
> // error: redefinition of concept 'is_summable' with different template
> parameters or requirements
> template<typenameT>
> conceptis_summable = requires(T x, T y) { x + y; }; // two
> parameter version
These two concepts are checking... the very same thing? I'm not sure
what you are after here.
If you want something like this instead:
> template <typename T>
> concept is_summable = requires(T x) { x + x; };
>
> template <typename T, typename U>
> concept is_summable = requires(T x, U y) { x + y; };
>
This sounds more interesting, but then again, you can't redeclare any
templated entity with a different set of template arguments.
The Standard simply calls the second version of the concept `_with`.
My 2 c,
-- Giuseppe D'Angelo
Received on 2023-12-19 15:29:32