the following code can not be compiled in VC6 ,but can be compiled in
VC.net2003
Is there any way that make vc6 to support STL better?
#include <iostream>
#include <vector>
using namespace std;
class myc
{
public:
myc():v(5){}
template<class myiter>
void tmpfunc(myiter first,myiter last,int i);
void fun();
private:
vector<int> v;
};
template<class myiter>
void myc::tmpfunc(myiter first,myiter last,int i)
{
for(;first!=last;++first)
{
cout<<*first;
}
cout<<endl;
}
void myc::fun()
{
tmpfunc(v.begin(),v.end(),0);
/*
in vc6 ,there is an error:
G:\myproject\con0002\con002.cpp(30) : error C2893: Failed to specialize
function template 'void __thiscall myc::tmpfunc(myiter,myiter,int)'
With the following template arguments:
'int *'
*/
}
int main()
{
myc m;
m.fun();
return 0;
}