I have begun testing some code based on Chapter 1.5.1 of the book Modern C++
Design by Andrei Alexandrescu. The test code is listed below and the
compiler error message that is generated is:
testPolicy.cpp(25) : error C2984: 'CPolicy' : template parameters '<template
parameter>' and '<template parameter>' do not match
testPolicy.cpp(22) : see declaration of 'CPolicy'
I am working with version 1 of Microsoft VC++ and running WinXP Pro. Would
someone be able to point out what I am doing wrong. I've already spent
about several hours comparing the test code with that illustrated in Andrei'
book and still cannot see what the problem is.
Ian
// =====================================
template<class T>
class CPolicy
{
public:
CPolicy (void) { tValue = 1; }
T get (void) { return tValue; }
void show (void) { std::cout << "\nCPolicy" << " type = " << get(); }
private:
T tValue;
};
// =====================================
template <template <typename> class CPolicy >
class CMyPolicyClass2 : public CPolicy<int>
{
public:
void show (void) { CPolicy().show(); }
};
int main(int argc, char* argv[])
{
return 0;
}
// ===================================
my correct email address is generated by substituting 'n0spam' with
'yahoo.com'.