Hi Miklós, Sorry for missing your first email. Miklós Tóth wrote:
Hi!
I have a problem with std::mem_fun_ref and boost::tuple. Here is my code: I have small LevelSetter class. It makes a level vector indexed by a transform_iterator value.
<snip code>
When I try to compile i get:
error: call of overloaded 'mem_fun_ref(<unresolved overloaded function type>)' is ambiguous candidates are: c:\mingw-4.6\bin\..\lib\gcc\i686-pc-mingw32\4.6.1\..\..\..\..\include\c++\4.6.1\bits\stl_function.h:697: std::mem_fun_ref_t<_Ret, _Tp> std::mem_fun_ref(_Ret (_Tp::*)()) [with _Ret = int&, _Tp = boost::tuples::cons
>] c:\mingw-4.6\bin\..\lib\gcc\i686-pc-mingw32\4.6.1\..\..\..\..\include\c++\4.6.1\bits\stl_function.h:702: std::const_mem_fun_ref_t<_Ret, _Tp> std::mem_fun_ref(_Ret (_Tp::*)()const) [with _Ret = const int&, _Tp = boost::tuples::cons >] What am I missing?
Those problems are usually due to the compiler not knowing which overload of the function to use. That can be solved using a static_cast (the bind documentation explains it pretty well [1])
Here's a solution that casts appropriately:
#include