
On 11/7/06, Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> wrote:
Hello everybody!
I'm trying to store a reference to a function depending upon a condition within a function object like this:
boost::function< double (std::size_t) > wf = (sIndex < m_maxIndex+1) ? ( boost::lambda::bind(boost::ref(m_cf), sDeg, boost::lambda::_1) ) : ( boost::ref(*m_wf) );
<snip>
Greetings,
Sebastian Weber
Try this - boost::function< double (std::size_t) > wf = (sIndex < m_maxIndex+1) ? boost::function< double (std::size_t) >( boost::lambda::bind(boost::ref(m_cf), sDeg, boost::lambda::_1) ) ) : ( boost::ref(*m_wf) ); i.e. make sure the first expression is explicitly a boost::function< double (std::size_t) >, as the second is convertible to that. Stuart Dootson