Is this possible? I always get ambiguities when I try it. Here's
some sample code:
class foo
{
public:
typedef enum { lost, reset } device_event;
typedef boost::function device_listener;
void add_listener(const device_listener& listener)
{
std::list::const_iterator iter =
std::find(listeners_.begin(), listeners_.end(), listener);
if (iter == listeners_.end())
listeners_.push_back(listener);
}
private:
std::list listeners_;
};
The above is slightly simplified from my actual code, but when I do
this I get the following:
I'm using Visual C++ 9.0 SP1
1>f:\dev\testing\window.h(42) : error C2666: 'operator ==' : 4
overloads have similar conversions
1> q:\include\boost\1.39.0\boost\function\function_template.hpp(995):
could be 'void boost::operator ==(const
boost::function2 &,const boost::function2 &)' [found
using argument-dependent lookup]
1> with
1> [
1> R=void,
1> T0=zg::window &,
1> T1=zg::window::device_event
1> ]
1> q:\include\boost\1.39.0\boost\function\function_base.hpp(791):
or 'bool boost::operator
==zg::window::device_listener(Functor,const boost::function_base &)'
[found using argument-dependent lookup]
1> with
1> [
1> Functor=zg::window::device_listener
1> ]
1> q:\include\boost\1.39.0\boost\function\function_base.hpp(782):
or 'bool boost::operator ==zg::window::device_listener(const
boost::function_base &,Functor)' [found using argument-dependent
lookup]
1> with
1> [
1> Functor=zg::window::device_listener
1> ]
1> or 'built-in C++ operator==(void (__thiscall
boost::function2::dummy::* )(void), void (__thiscall
boost::function2::dummy::* )(void))'
1> with
1> [
1> R=void,
1> T0=zg::window &,
1> T1=zg::window::device_event
1> ]
1> while trying to match the argument list '(const
zg::window::device_listener, const zg::window::device_listener)'
1