I need to copy a set to another one based on more than one key. the keys are used to -collectively- maintain the uniqueness as well as the order of elements in the set.
My class:
class LaneConnector {
public:
    const Lane* getLaneFrom() const {
        return From;
    }
    const Lane* getLaneTo() const {
        return To;
    }
private:
    Lane* From;
    Lane* To;
}
my functor:
struct MyLaneConectorSorter {
  bool operator() (const LaneConnector* rhs, const LaneConnector* lhs) const
  {
    const Lane* a = lhs->getLaneFrom();
    const Lane* b = rhs->getLaneFrom();
    bool key1 = a->getLaneID() < b->getLaneID();
    bool key2 = a->getLaneParent->ID() < b->getLaneParent->ID();
    bool key2 = a->getLaneParent->getParent->ID() < b->getLaneParent->getParent->ID(); 
    //remind you that I NEED the elements to be in ascending order of 
    //getLaneParent->getParent->ID() ,a->getLaneParent->ID() and then a->getLaneID()
    //duplicate elements are the ones which have all three keys same and need to be discarded 
    return (key1 && key2 && key3); //which dont seem to be working
  }
};
and my source and origin sets:
const std::set<LaneConnector*> src = ..... ; //the getter give me a const version
std::set<sim_mob::LaneConnector *, MyLaneConectorSorter> dest;
and how I fill it up:
for(std::set<sim_mob::LaneConnector*>::iterator it = tempLC.begin(); it != tempLC.end(); it++)
{
    dest.insert(*it);//I know I can insert it right at the time of declaration, but keep it like this for now...please 
}
your kind help would be highly appreciated.
 
     
     
     
     
     
    