U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » Algorithms and Vectors
Re: Algorithms and Vectors [message #28132 is a reply to message #28130] Tue, 17 August 2010 23:45 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1310
Registered: September 2007
Ultimate Contributor
Yep, you should use a predicate :

class Predicate
{
    public:
        bool operator() (const M& lhs, const M& rhs) {
            return lhs.somedata < rhs.somedata;
}


then

M myVar;  // M is your data class/struct
Vector<M> myVect;
FindBinary(myVect, myVar, Predicate())


Ciao

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Open An image upon startup
Next Topic: Assert failed in core/value.h line 464
Goto Forum:
  


Current Time: Sun May 10 11:34:38 GMT+2 2026

Total time taken to generate the page: 0.00580 seconds