Is there a way in C++11/14/17 to access a member of the subclass in the parent class when using CRTP?
template <typename T>
class A {
public:
using C = typename std::result_of<decltype(&T::next)(T)>::type;
};
class B : A<B> {
public:
int next() { ... };
};
This should result in A<B>::C
and B::C
being int
.