有問題的代碼:升壓未定義的引用誤差的boost ::綁定重載運算
boost::function<bool()> isSpecialWeapon = boost::bind(&WeaponBase::GetType,this) == WeaponType::SPECIAL_WEAPON;
我得到的錯誤是像這樣:
undefined reference to `boost::_bi::bind_t<bool, boost::_bi::equal,
boost::_bi::list2<boost::_bi::bind_t<WeaponType::Guns,
boost::_mfi::cmf0<WeaponType::Guns, WeaponBase>,
boost::_bi::list1<boost::_bi::value<WeaponBase*> > >,
boost::_bi::add_value<WeaponType::Guns>::type> > boost::_bi::operator==
<WeaponType::Guns, boost::_mfi::cmf0<WeaponType::Guns, WeaponBase>,
boost::_bi::list1<boost::_bi::value<WeaponBase*> >, WeaponType::Guns>
(boost::_bi::bind_t<WeaponType::Guns, boost::_mfi::cmf0<WeaponType::Guns, WeaponBase>,
boost::_bi::list1<boost::_bi::value<WeaponBase*> > > const&, WeaponType::Guns)'
什麼是你想實現,到底? – 2013-05-02 18:57:46
@EmileCormier嘗試創建一個函數來確定當前對象是否屬於X類型,因爲它可以是{X,Y,Z}類型 – dchhetri 2013-05-02 18:59:00
您是否願意/能夠使用C++ 11功能? – 2013-05-02 19:02:55