Boost logo

Boost Users :

Subject: [Boost-users] Problem with boost::bind, boost::shared_ptr and std::find_if algorithm
From: przemyslaw.sliwa_at_[hidden]
Date: 2010-08-03 09:34:02


All,

I have the following data sructure:

                struct WeightedTimeHolder
                {
                        double time;
                        double dt;
                        double weight;
                        double dailyVol;
                        double varDelta_t;
                        double cutToCutdailyVol;
                        double extraVar;
                        double varPlusEventVar;
                        double aggrVar;
                        double implVol;
                        int cut;
                }

and typedef multimap<int, boost::shared_ptr<WeightedTimeHolder> > DataMap.

Now given value of cut in this data structure I would like to find the
next position in DataMap which corresposnds to this gven value, I do it in
the following manner:

void nextPositionForCut(DataMap::iterator& pos, CutOffType cut) const
{
        if((*pos).second->cut!=cut)
                while((*(++pos)).second->cut!=cut && pos!=m_pData->end())
{}

                // convert to boost::bind for better use!
                //pos = find_if(pos, m_pData->end(),
boost::bind(&DataMap::value_type::second::value_type::cut, _1) == cut);
}

Since this looks really ugly I would like to ask you how this can be
converto to find_if algorithm with a little help of boost::bind. I tried
but could not succees.

Thanks for help,

Przemyslaw

___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-845C5H for additional disclosures.



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