On Aug 30, 2005, at 7:25 AM, Pierre viallet wrote:
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
Probably, because BLL does not know about valarray, and doesn't know what the return type of [] should be. I haven't tested this, but you can try wrapping bll::var(dvv)[bll::var(uiIdx)++] with bll::ret as follows : bll::ret<double&>(bll::var(dvv)[bll::var(uiIdx)++]) Best, Jaakko Järvi
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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users