I have a concept concept_a
and a second concept concept_ab
with more requirements, e.g.
template<typename T> concept concept_a = ...;
template<typename T> concept concept_b = ...;
template<typename T> concept concept_ab = concept_a<T> && concept_b<T>;
Now I have some function f
for these concepts. In the function for the more strict concept I want to reuse the function for the less strict concept:
int f(concept_a auto a) {return 1;}
int f(concept_ab auto ab)
{
int n =f<concept_a> (ab);
return n+10;
}
This, however, does not work since f<concept_a>
is syntactically not valid. Of course, I can solve this problem by adding another level of indirection, (i.e. add a function f_concept_a
that is called by both f
). My question is: is there is a direct way to call a function of a different (but related) concept?