How does one implement NOT such that fn accepts Y but not X, without creating multiple concepts and chaining them?
template<class T>
concept Fooable = requires(T t) {
{ t.foo() };
NOT({ t.bar()}); // imaginary syntax
};
struct Y {
void foo() {}
};
struct X {
void foo() {}
void bar() {}
};
template <Fooable T>
void fn(T t) {}
You can use NOT with the
requires-clause as it yields abool:Demo