Boost logo

Boost Users :

From: Pierre viallet (pviallet_at_[hidden])
Date: 2005-08-30 07:25:26


I’m just starting to use boost::lambda an boost::lambda::bind, and I do not understand why this do not work whith valarray :

 

 

namespace std{

 

class CToto{

public:

      CToto(double _i): a(_i) {}

      CToto(): a(0.0) {}

      double get() const

            {return a;}

private:

       double a;

};

 

 

std::vector<std::CToto *> aTotoPtrVect;

aTotoPtrVect.push_back(new std::CToto(1.1));

aTotoPtrVect.push_back(new std::CToto(2.2));

aTotoPtrVect.push_back(new std::CToto(3.3));

aTotoPtrVect.push_back(new std::CToto(4.4));

 

std::vector <double> dv(std::distance((aTotoVect.begin(), aTotoVect.end());

std::for_each(aTotoPtrVect.begin(), aTotoPtrVect.end(), bll::var(dv)[bll::var(uiIdx)++] = bll::bind(&std::CToto::get, bll::_1)); // work fine

 

std::valaray <double> dvv(std::distance((aTotoVect.begin(), aTotoVect.end());

std::for_each(aTotoPtrVect.begin(), aTotoPtrVect.end(), bll::var(dvv)[bll::var(uiIdx)++] = bll::bind(&std::CToto::get, bll::_1)); // do not work

 

Is someone could explain me that ?

 

                
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !



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