c++ - Curiously recurring templates with template leaf classes -


i thinking using curiously recurring template pattern application. however, classes operate on user defined types. understand if possible create structure similar 1 shown below:

template <class t_leaftype> class basetrajectorypoint { };   template <class mytype> class mytrajectorypoint: public basetrajectorypoint<mytrajectorypoint> {     private:             mytype a; }; 

the code above fails compile following error:

type/value mismatch @ argument 1 in template parameter list ‘template class basetrajectorypoint’

are there alternative ways of approaching problem? use static polymorphism, prefer define possible methods in base class.

template <class t_leaftype> class basetrajectorypoint { };   template <class mytype> class mytrajectorypoint: public basetrajectorypoint<mytrajectorypoint<mytype> > {     private:             mytype a; }; 

mytrajectorypoint isn't type, it's template; when pass template parameter, it's seen template<typename> class t>, not template<class t> - , latter base class expecting. mytrajectorypoint<mytype> names type, can use template parameter of base class.

of course, can change declaration of basetrajectorypoint template<template<class> class t_leaftype>, have use class template template parameter, never complete type.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -