Код: Выделить всё
//Test class
class Foo {
void test();
};
//Concept to validate existence of "test()" method.
template concept FooType = requires (X x) {
x.test();
};
//Apply the concept to a template parameter
template requires FooType class Bar {
};
//instantiate
Bar a;
Код: Выделить всё
error: template constraint failure for ‘template requires FooType class Bar’ 24 | Bar a;
required for the satisfaction of ‘FooType’ [with Y = Foo] ... in requirements with ‘X x’ [with X = Foo]
note: the required expression ‘x.test()’ is invalid
Подробнее здесь: https://stackoverflow.com/questions/798 ... k-with-gcc