Hello all:
I'm trying to boost::bind a couple of callbacks and was getting errors;
could someone help me figure out what's going on?
First, the errors:
19:22:36: Compiling staticObject.cpp.
staticObject.cpp: In constructor ‘StaticObject::StaticObject()’:
staticObject.cpp:20:143: error: no matching function for call to
‘OlcStringEntry::OlcStringEntry(std::string, int,
boost::_bi::bind_t,
boost::_bi::list1 > >,
boost::_bi::bind_t,
boost::_bi::list2, boost::arg<1> > >)’
staticObject.cpp:20:143: note: candidates are:
In file included from staticObject.h:7:0,
from staticObject.cpp:5:
olc.h:48:3: note: OlcStringEntry::OlcStringEntry(const string&, FLAG,
StringGetter&, StringSetter&)
olc.h:48:3: note: no known conversion for argument 3 from
‘boost::_bi::bind_t,
boost::_bi::list1 > >’ to
‘StringGetter& {aka boost::function&}’
olc.h:42:7: note: OlcStringEntry::OlcStringEntry(const OlcStringEntry&)
olc.h:42:7: note: candidate expects 1 argument, 4 provided
now, here's how I call it:
AddOlc(new OlcStringEntry(std::string("name"), OF_NORMAL,
boost::bind(&BaseObject::GetName, this),
boost::bind(&BaseObject::SetName, this, _1)));
baseobject's relevant methods look like:
virtual std::string GetName() const;
virtual void SetName(const std::string &s);
and the relevant tidbits from olc.h:
typedef boost::functionstd::string() StringGetter;
typedef boost::function StringSetter;
and OlcStringEntry's ctor looks like:
OlcStringEntry(const std::string &name, FLAG flag, StringGetter& get,
StringSetter& set);
Any info here would be appreciated.
Thanks,
--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.