How can I get the return type of a member function in the following example?
template <typename Getter>
class MyClass {
typedef decltype(mygetter.get()) gotten_t;
...
};
The problem, of course, is that I don’t have a “mygetter” object while defining MyClass.
What I’m trying to do is: I’m creating a cache that can use, as it’s key, whatever is returned by the getter.
I’m not quite sure what you want, but it seems
mygetteris supposed to be simply any object of typeGetter. Usestd::declvalto obtain such an object without anything else (you can only use it for type deduction)