Date: Mon, 2 Sep 2024 14:54:30 -0400
On Mon, Sep 2, 2024 at 2:35 PM Robin Savonen Söderholm via Std-Proposals <
std-proposals_at_[hidden]> wrote:
>
> I've come into situations with concepts where I'd like to do something
> along the lines of this:
> ```c++
> template <typename T>
> concept has_foo = requires(T&& t, int i /* and so on...*/ ) { t.foo1(i);
> /*and maybe more functions*/};
>
> template <typename T>
> concept fooable = requires(T&& t, has_foo auto&& f) { t.do_foo_stuff(f); };
> ```
> , but I can't as far as I know. [...]
> I would like to have a way to express "given some type that fulfills the
> constraint X, type T shall fulfil Y."
> I understand that this can be a very expensive feature, but I would like
> to at least discuss the idea. Or is there a paper for something similar?
>
This is physically impossible. See:
https://quuxplusone.github.io/blog/2020/08/10/concepts-cant-do-quantifiers/
Cheers,
Arthur
std-proposals_at_[hidden]> wrote:
>
> I've come into situations with concepts where I'd like to do something
> along the lines of this:
> ```c++
> template <typename T>
> concept has_foo = requires(T&& t, int i /* and so on...*/ ) { t.foo1(i);
> /*and maybe more functions*/};
>
> template <typename T>
> concept fooable = requires(T&& t, has_foo auto&& f) { t.do_foo_stuff(f); };
> ```
> , but I can't as far as I know. [...]
> I would like to have a way to express "given some type that fulfills the
> constraint X, type T shall fulfil Y."
> I understand that this can be a very expensive feature, but I would like
> to at least discuss the idea. Or is there a paper for something similar?
>
This is physically impossible. See:
https://quuxplusone.github.io/blog/2020/08/10/concepts-cant-do-quantifiers/
Cheers,
Arthur
Received on 2024-09-02 18:54:43