Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 1308
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: Sat Jun 21 20:12:12 CEST 2025

Total time taken to generate the page: 0.04060 seconds