Using lambda expressions in stl algorithms

Hello,
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

On Tue, Dec 14, 2010 at 2:49 PM,
Hello,
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
mapType; mapType ccyOut;
std::for_each(ccyOut.begin(), ccyOut.end(), (&*boost::lambda::_1)->*&CcyCplEventKey::Event);
Cheers
Ummm - for a start, a std::map iterator references a std::pair containing the key and value for that map entry, so you need to get hold of the 'first' member of the std::pair to use the key. Without type definitions for EventType, CurrencyEventPtr and CurrencyCouple, it's difficult to go further than that... Stuart Dootson

AMDG On 12/14/2010 6:49 AM, przemyslaw.sliwa@uk.bnpparibas.com 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
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
participants (3)
-
przemyslaw.sliwa@uk.bnpparibas.com
-
Steven Watanabe
-
Stuart Dootson