Boost logo

Boost Users :

Subject: [Boost-users] [lambda] newbie: lambda to help in std::accumulate
From: Micha³ Nowotka (mmmnow_at_[hidden])
Date: 2009-01-25 08:20:17


I want to compute sum of logarithms so i wrote:

#include <cmath>

double evaluate(const vector<double>& win_probabls)
{
         return accumulate (win_probabls.begin(), win_probabls.end(), 0,
lambda::_1 + log(lambda::_2) );
}

but this code doesn't compile. Does anyone know why?

-- 
Micha³ Nowotka

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