I got following code:
template<typename T>
concept con1 = requires(T t, std::string s){
{ t[s] } -> std::same_as<std::string>;
};
using function_signature = std::function<void ( con1 auto functor)>; // ERROR!
while the compiler has no problem me defining the lambda directly:
auto lambda_1 = [](con1 auto functor){....}
The reason why I want the former to work is the following:
template<std::semiregular T>
class R{
T functor;
R() = default;
register_functor(T functor_) { functor = std::move(functor_);}
}
If I get to instantiate my class using the signature like:
auto rr = R<function_signature>();
I can get to register my functor at a later stage, and even change the function at run time as long as I keep the signature the same. Using the lambda directly means I am stuck with whatever my lambda is at the time I instantiate the class R