c++萌新 template报错
#include<bits/stdc++.h>
using namespace std;
template<size_t SIZE>
class HP{
private:
size_t Len;
bool ifPlus;
short hp[SIZE];
public:
void clear(){
int i;
ifPlus = true;
Len = 0;
for(i=0; i<Len; ++i) hp[i] = 0;
}
HP operator=(HP<size_t aSize> a){
int i;
clear();
ifPlus = a.ifPlus;
Len = a.Len;
if(SIZE < a.Len){
printf("Out of memory!");
exit(0);
}
for(i=0; i<a.Len; ++i) hp[i] = a.hp[i];
return temp;
}
信息:
[Error] template argument 1 is invalid
[Error] template argument 1 is invalid (他说了两遍)
[Error] 'HP' is not a template
[Error] expected primary-expression before 'aSize'
[Error] expected '>' before 'aSize'
谢谢大佬