A
Asif Zaidi
Hi:
Trying to compile the code below using lambda functionality and
getting all sorts of compile errors - plz advise
The code is (if working) trying to calculate the length of a vector.
Thanks
Asif
========
#include <numeric>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#include <iostream>
#include<boost/lambda/lambda.hpp>
using namespace std;
using namespace boost;
using namespace std;
using namespace std::tr1;
using namespace std::tr1:laceholders;
int main()
{
vector<double> v;
v.push_back(7);
v.push_back(24);
cout << sqrt(accumulate(v.begin(), v.end(), 0.0, _1*_1 ) << endl;
return 0;
}
Trying to compile the code below using lambda functionality and
getting all sorts of compile errors - plz advise
The code is (if working) trying to calculate the length of a vector.
Thanks
Asif
========
#include <numeric>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#include <iostream>
#include<boost/lambda/lambda.hpp>
using namespace std;
using namespace boost;
using namespace std;
using namespace std::tr1;
using namespace std::tr1:laceholders;
int main()
{
vector<double> v;
v.push_back(7);
v.push_back(24);
cout << sqrt(accumulate(v.begin(), v.end(), 0.0, _1*_1 ) << endl;
return 0;
}