|
Boost Users : |
Subject: Re: [Boost-users] Using lambda expressions in stl algorithms
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-12-14 10:21:10
AMDG
On 12/14/2010 6:49 AM, przemyslaw.sliwa_at_[hidden] wrote:
> Could someone tell me why this code does not compile? Can it be modified
> in order to compile?
>
> struct CcyCplEventKey
> {
> CurrencyCouple CcyCpl;
> EventType Event;
> }
>
> typedef std::map<CurrencyEventKey, CurrencyEventPtr> mapType;
>
> mapType ccyOut;
>
> std::for_each(ccyOut.begin(), ccyOut.end(),
> (&*boost::lambda::_1)->*&CcyCplEventKey::Event);
boost::lambda::_1 gets replaced with an object of type
std::pair<const CurrencyEventKey, CurrencyEventPtr>.
a) std::pair can't be dereferenced.
b) Even if it could be, you can't call a member function of CcyCplEventKey
with a std::pair.
c) Accessing a data member has no side-effects. The
for_each doesn't do anything, so I don't know what
you're trying to accomplish.
In Christ,
Steven Watanabe
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