65,184
社区成员




#include <vector>
using namespace std;
template<typename TAV>
class Container
{
private:
vector<TAV> m_List;
vector<TAV>::iterator m_Itor;
public:
void add(TAV node)
{
m_List.push_back(node);
}
}
int test()
{
Container<int> t;
t.add(1);
}
#include <cstdio>
template<typename T>
struct tester
{
enum{value = T::value}; // value依赖于T,假定value是一个值,而不是类型。
};
struct orz
{
enum{value=123};
};
int main()
{
printf("%d\n", tester<orz>::value);
return 0;
}
#include <cstdio>
template<typename T>
struct tester
{
enum{value = T::value};
};
struct orz
{
enum{value=123};
};
int main()
{
printf("%d\n", tester<orz>::value);
return 0;
}
vector<TAV>::iterator m_Itor;
改为
typename vector<TAV>::iterator m_Itor;