J
joseph cook
I am getting a compile error on any compiler I try, so I know I have
an error here. Can anyone see it?
//includes
class Foo
{
public:
Foo(int a){m_hi = a;}
int hi(){return m_hi;}
int m_hi;
};
int main()
{
std::vector<Foo *> data;
data.push_back(new Foo(3));
max_element(data.begin(),
data.end(),
std::mem_fun(&Foo::hi));
}
gives a compile error:
in gcc: stl_algo.h:4565: error: no match for call to
'(std::mem_fun_t<int, Foo>) (Foo*&,Foo*&)'
stl_function.h:600: note: candidates are: _Ret
std::mem_fun_t<_Ret,_Tp>:perator()(_Tp*) const [with _Ret = int,
_Tp = Foo]
help!
}
an error here. Can anyone see it?
//includes
class Foo
{
public:
Foo(int a){m_hi = a;}
int hi(){return m_hi;}
int m_hi;
};
int main()
{
std::vector<Foo *> data;
data.push_back(new Foo(3));
max_element(data.begin(),
data.end(),
std::mem_fun(&Foo::hi));
}
gives a compile error:
in gcc: stl_algo.h:4565: error: no match for call to
'(std::mem_fun_t<int, Foo>) (Foo*&,Foo*&)'
stl_function.h:600: note: candidates are: _Ret
std::mem_fun_t<_Ret,_Tp>:perator()(_Tp*) const [with _Ret = int,
_Tp = Foo]
help!
}