class Key{
public:
float m_XX;
float m_SLP;
Key(float XX,float SLP):m_XX(XX),m_SLP(SLP){}
Key(const Key& key):m_XX(key.m_XX),m_SLP(key.m_SLP){}
};
struct keyComp {
bool operator() (const Key& lhs, const Key& rhs) const
{
if(lhs.m_XX < rhs.m_XX)
return true;
else return lhs.m_SLP < rhs.m_SLP;
}
};
class K{
public:
int m_IND;
int m_DIR;
float m_XC;
float m_SLP;
K(const K &k):m_IND(k.m_IND),m_DIR(k.m_DIR),m_XC(k.m_XC),m_SLP(k.m_SLP){}
K(unsigned int IND= 0,int DIR=0,float XC = 0,float SLP = 0):m_IND(IND),m_DIR(DIR),m_XC(XC),m_SLP(SLP){}
};
///////////////////////
class ActiveEdgeTable
{
private:
map<Key,K,keyComp> m_KList;
public:
void insert(unsigned int J,int DI,float XX,float SL);
void deleteK(const Key& key);
map<Key,K,keyComp>& getKList(){return m_KList;};
};
void ActiveEdgeTable::insert(unsigned int J,int DI,float XX,float SL)
{
Key key(XX,SL);
K k(J,DI,XX,SL);
m_KList[key]= k;
}
The insertion is not correct the old values in map are updated....
Can somebody help?