I have the following piece of code:
void MultiLog::removeLog(const std::string& name)
{
std::remove_if(m_logs.begin( ), m_logs.end( ), (boost::lambda::_1 ->* &Log::getName) == name);
}
Which fails to compile with the typical spectacular list of template error messages, the first of which is
"error C2784 ... could not deduce template argument for 'const boost::lambda::lambda_functor<T> &' from 'boost::lambda::detail::member_pointer_caller<RET,A,B>'"
I'm assuming that the error is because each element here is a shared_ptr<Log>, rather than a raw pointer to Log. Using bind to wrap shared_ptr::get appears to work:
void MultiLog::removeLog(const std::string& name)
{
std::remove_if(m_logs.begin( ), m_logs.end( ),
boost::bind(&Log::getName, boost::bind(&LogPtr::get, _1)) == name);
}
but is there are way to use the significantly cleaner & clearer member pointer operator syntax while using shared_ptr's?
Thanks,
MBC