I am trying to understand the following kind of classes from the dlib project.
template<typename EXP>
class matrix_exp
{
public:
//typedef matrix<type, NR, NC, mem_manager_type, layout_type> matrix_type;
matrix_exp()
{
cout << "matrix_exp()" << endl;
cout << __PRETTY_FUNCTION__ << endl;
}
void foo()
{
cout << "matrix_exp" << endl;
}
};
template<typename T, long num_rows, long num_cols, typename mem_manager, typename layout>
class matrix: public matrix_exp<matrix<T, num_rows, num_cols, mem_manager, layout> >
{
public:
void foo()
{
cout << "matrix" << endl;
}
};
How is the based class uses derived class as it's template? They have also used typedef matrix matrix_type; inside the matrix_exp. Can someone clarify how this works?