c++ - Writing a birthday calendar with a multiset of birthday objects but sorting isn't working -


i writing birthday calendar multiset of birthday objects. comparison function isn't sorting right , can't search b-day name.

class comparename     {     public:         bool operator()(birthday* a,birthday *b)         {             if(a->getlastname()==b->getlastname() && a->getfirstname() != b->getfirstname())                 return( a->getfirstname() < b->getfirstname());             else                 return (a->getlastname()<b->getlastname());         } 

this comparison function. wanting able search database birthday or partial birthday , whole name. cant search name part working.

    void multiset::searchbyname( birthday *a) {     nameset::iterator result;      result=nameset.find(a);       if(result!=nameset.end())         (*result)->print(); } 

i have used type def multiset , have used in definition include object functor, have left out of code excerpt brevity.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -