I'm having trouble finding mem_fun_ref . I must admit, I usually use functions for these kinds of things, as they can be built into speed and profit. However, this code will not be a bottleneck, so I wanted to try this thing.
Here is an example of what I want to do. I know there are other ways to do this. I do not want to use copy , I do not want to use range member functions, I do not want to use back_inserter . I specifically want to use mem_fun_ref . This is just a simple example, the real case is much more complicated. However, I really donβt know why this is wrong, but I am not familiar with mem_fun_ref or mem_fun .
Here I want to work:
#include <list>
But I get 3 errors:
1>c:\program files\microsoft visual studio 9.0\vc\include\functional(276) : error C2529: '_Right' : reference to reference is illegal 1>c:\program files\microsoft visual studio 9.0\vc\include\functional(281) : error C2529: '_Right' : reference to reference is illegal 1>c:\program files\microsoft visual studio 9.0\vc\include\functional(282) : error C2535: 'void std::binder1st<_Fn2>::operator ()(const int &(&)) const' : member function already defined or declared 1> with 1> [ 1> _Fn2=std::mem_fun1_ref_t<void,std::vector<int>,const int &> 1> ] 1> c:\program files\microsoft visual studio 9.0\vc\include\functional(276) : see declaration of 'std::binder1st<_Fn2>::operator ()' 1> with 1> [ 1> _Fn2=std::mem_fun1_ref_t<void,std::vector<int>,const int &> 1> ]
reference to reference is illegal makes me think that a function should take a parameter by value. But of course, this cannot be changed in vector , and it is also impossible to change in my code. Are there any simple changes to make this work? I need a solution that is 1-liner.
source share