mardi 23 octobre 2018

C++ template class inherit itself

I have some trouble in reading some source codes from Eigen library. Here is the base class TensorBase:

template<typename Derived>
class TensorBase<Derived, ReadOnlyAccessors> {
  ...
};

In the following code, How can the base class TensorBase inherit itself? What's the point of using this inheritance? Is this common?

template<typename Derived, int AccessLevel = 
         internal::accessors_level<Derived>::value>
class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
  ...
};

Aucun commentaire:

Enregistrer un commentaire