Nik*_*s R 7 c++ templates crtp
在使用CRTP时,C++ 11/14/17中是否有一种方法可以访问父类中的子类成员?
template <typename T>
class A {
public:
using C = typename std::result_of<decltype(&T::next)(T)>::type;
};
class B : A<B> {
public:
int next() { ... };
};
Run Code Online (Sandbox Code Playgroud)
这应该导致A<B>::C和B::C存在int.