struct Foo
{
char * m_name;
Foo(char * name){m_name = name;};
void Bar(){std::cout<<"Bar name = "<<m_name << std::endl;}
void Bar1(int i){std::cout<<"Bar1 name = "<< m_name << " i = " << i << std::endl;}
};
int main(int argc, char* argv[])
{
Foo f1("foo1");
Foo f2("foo2");
std::mem_fun_ref(&Foo::Bar)(f1); // error
std::mem_fun1_ref(&Foo::Bar1)(f1, 2); // error
printf("Hello World!\n");
return 0;
}
compiler error
Compiling...
T7.cpp
c:\program files\microsoft visual studio\vc98\include\functional(263) : error C2562: '()' : 'void' function returning a value
c:\program files\microsoft visual studio\vc98\include\functional(262) : see declaration of '()'
c:\program files\microsoft visual studio\vc98\include\functional(263) : while compiling class-template member function 'void __thiscall std::mem_fun_ref_t<void,struct Foo>::operator ()(struct Foo &) const'
Error executing cl.exe.
T7.exe - 1 error(s), 0 warning(s)
На 7.1 всё ok.
... << RSDN@Home 1.1.0 stable >>