0

I'm trying to build a program that implements policies to change behavior. I have one main gradient descent class which takes two policies, processingPolicy and threadingPolicy. I then have another specific class that inherits the gradient descent class via the curiously recursive template pattern. Now the specific class also uses different policies, one of these policies should also change the threading policy of gradient descent. So I want to do the following:

template<class _C, class _TP, class _PP> class GradientDescent: public _TP, public _PP
{
};

template<class _TP> specificImplementation: 
    public _TP, 
    public GradientDescent<specificImplementation<_TP>, _TP::GDTP, _TP::GDPP>{
};

class specificImplementationPolicy1{
typedef GDTP1 GDTP;
typedef GDPP1 GDPP;
};
class specificImplementationPolicy2{
typedef GDTP2 GDTP;
typedef GDPP2 GDPP;
};

Now ideally the specific implementation's policies will determine the policies of gradient descent via the typedef'd policies GDTP and GDPP. But when I do this I get the following compiler error:

error C2923: 'GradientDescent' : '_TP::GDTP' is not a valid template type argument for parameter '_TP'
Daniel Moodie
  • 357
  • 1
  • 10
  • 5
    you are missing `typename` before _TP::GDTP – Creris Feb 03 '15 at 18:31
  • Off-topic, but you shouldn't use [reserved names](http://stackoverflow.com/questions/228783) like `_C` for your template parameters. – Mike Seymour Feb 03 '15 at 19:00
  • Thanks, I was going off of what I saw a lot in other libraries using a "_" in the beginning to name input template variables. Never noticed that they didn't use capital letters. – Daniel Moodie Feb 04 '15 at 22:17

0 Answers0