N
nw
Hi All,
Could someone point me in the right direction with this code? If I
change "myclass<_prec>::atype t = 0;" to " myclass<double>::atype t
= 0;" it compiles. Am I not allowed to use a template argument as a
template argument for another class? gcc gives the error:
templateargasarg.cpp:17: error: expected `;' before 't'
templateargasarg.cpp:18: error: 't' was not declared in this scope
Any help appreciated.
#include <iostream>
using namespace std;
template<class _prec=double>
class myclass {
public:
typedef int atype;
};
template<class _prec=double>
class myclass2 {
public:
_prec method() {
myclass<_prec>::atype t = 0;
return t;
}
};
int main() {
myclass2<> m;
}
Could someone point me in the right direction with this code? If I
change "myclass<_prec>::atype t = 0;" to " myclass<double>::atype t
= 0;" it compiles. Am I not allowed to use a template argument as a
template argument for another class? gcc gives the error:
templateargasarg.cpp:17: error: expected `;' before 't'
templateargasarg.cpp:18: error: 't' was not declared in this scope
Any help appreciated.
#include <iostream>
using namespace std;
template<class _prec=double>
class myclass {
public:
typedef int atype;
};
template<class _prec=double>
class myclass2 {
public:
_prec method() {
myclass<_prec>::atype t = 0;
return t;
}
};
int main() {
myclass2<> m;
}