Check the existence of a member function template in a concept definition

Viewed 72

Suppose I have a concept Concept and a bunch of similar types that provide a member function template as follows:

class Typical {
  template<Concept T>
  auto something() { return ...; }
};

How do I write a concept HasSomething that tests for the existence of such a member template function? Note that the function template has no arguments and is designed to be called as obj.something<T>(). I have to test whether the function is callable with any Concept.

Edit: all the approaches I can think of require to at least provide an instance of T. I can imagine how to test whether Typical::template something is well-formed if something where supposed to be a class template, but not for a function template.

0 Answers
Related