|
The following code is reported in GNU G ++
test.cpp: 53: Error: dependency name ‘CAttrValue <TVal> :: CAttrValue’ was resolved to a non-type, but instantiation produced a type
test.cpp: 53: Note: If you want to specify a type, use ‘typename CValue <TVal> :: CValue’
Excuse me, what did I write wrong? ? I use typename CAttrValue <TVal> :: CAttrValue () The result is not executed.
#include <iostream>
#include <ext / hash_map>
using namespace std;
using namespace __gnu_cxx;
typedef unsigned short WORD;
template <typename TVal>
struct CValue
{
CValue ()
{
base = 0;
extend = 0;
attach = 0;
rate = 100;
value = 0;
}
CValue (TVal b, TVal e, TVal a, WORD r)
{
base = b;
extend = e;
attach = a;
rate = r;
}
TVal base;
TVal extend;
TVal attach;
WORD rate;
TVal value;
};
template <typename TVal>
struct CMaxValue: CValue <TVal>
{
CMaxValue ()
{
current = 0;
CValue <TVal> :: CValue <TVal> ();
}
CMaxValue (TVal b, TVal e, TVal a, WORD r, TVal c)
{
current = c;
CValue <TVal> :: CValue (b, e, a, r);
}
TVal current;
};
int main ()
{
CMaxValue <long> = CMaxValue <long> (1,2,3,4,5);
// CMaxValue <long>;
cout <<. base << endl;
} |
|