Boost logo

Boost Users :

Subject: [Boost-users] Lambda and placeholders
From: Sven Bauhan (sven.bauhan_at_[hidden])
Date: 2012-03-30 13:19:24


Hi,

I just tried to use boost::lambda to prevent from creating an extra Functor
class just for one call.
This is the code I tried:

        std::deque<LightningSlice>::const_iterator l
                = std::find_if( m_lightnings.begin(), m_lightnings.end(),
                boost::lambda::_1.timeslice().contains(time_) );

with
        typedef std::deque<LightningSlice> LightningQueue;
        LightningQueue m_lightnings; //!< The lightnings in timeslices

        const boost::posix_time::time_period& LightningSlice::timeslice() const
{
                return this->m_period;
        }

Then I get the error:
../LightningIndex.cpp:38: error: 'const struct
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >' has no member
named 'timeslice'

What did I wrong?

Thanks,
Sven


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net