S
sop3k
Compiling the code below, by VC++ 6.0 I get an error like this:
visual c++\vc98\include\functional(263) : error C2562: '()' : 'void'
function returning a value
visual c++\vc98\include\functional(262) : see declaration of '()'
visual c++\vc98\include\functional(263) : while compiling
class-template member function 'void __thiscall
std::mem_fun_ref_t<void,class CStr>:perator
()(class CStr &) const'
####Code####
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
class CStr{
std::string s;
public:
CStr(std::string sl) { s= sl;}
void Print(){ std::cout<<s<<std::endl; }
};
char t[10];
std::vector<CStr> v;
std::string el;
int main(){
for(int i=0;i<10;i++){
el+=itoa(i,t,10);
v.push_back(el);
}
std::for_each(v.begin(),v.end(),std::mem_fun_ref(&CStr:rint));
return 0;
}
What's wrong?
With Best Regards
Tomasz Sobkowiak
visual c++\vc98\include\functional(263) : error C2562: '()' : 'void'
function returning a value
visual c++\vc98\include\functional(262) : see declaration of '()'
visual c++\vc98\include\functional(263) : while compiling
class-template member function 'void __thiscall
std::mem_fun_ref_t<void,class CStr>:perator
()(class CStr &) const'
####Code####
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
class CStr{
std::string s;
public:
CStr(std::string sl) { s= sl;}
void Print(){ std::cout<<s<<std::endl; }
};
char t[10];
std::vector<CStr> v;
std::string el;
int main(){
for(int i=0;i<10;i++){
el+=itoa(i,t,10);
v.push_back(el);
}
std::for_each(v.begin(),v.end(),std::mem_fun_ref(&CStr:rint));
return 0;
}
What's wrong?
With Best Regards
Tomasz Sobkowiak