#include<concepts> class Base { public: Base() {} }; class Derived : public Base { public: Derived() {} }; template<typename t> concept con = std::is_class_v<t> && std::derived_from<t, base>; void f(con auto&& x) {} int main() { f(Derived()); // r-value: Ok Derived d; f(d); // l-value: MSVC ERROR "no matching overloaded function found" }
template<typename t> concept con = std::is_class_v<t> && std::derived_from<t, base>;
Base
base
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)