C++は美しい
bool operator <(const POINT& inA, const POINT& inB){
int rA2 = ( inA.x * inA.x + inA.y * inA.y );
int rB2 = ( inB.x * inB.x + inB.y * inB.y );
return ( ( rA2 < rB2 ) || ( ( rA2 == rB2 ) && ( inA.y < inB.y ) ) );
}

inline bool operator()(const CNode* a, const CNode* b) const{
if(a->key1 != b->key1) return a->key1 > b->key1;
if(a->key2 != b->key2) return a->key2 > b->key2;
if(a->key3 != b->key3) return a->key3 > b->key3;
return false;
}

NODE_POINTER_SET NodePointerSet2(dammy, dammy+0, CNode());
for(int i=0; i<NUM; i++){
node = new CNode();
pair<NODE_POINTER_SET::iterator, bool> insert_result = NodePointerSet2.insert(node); //setへ登録
if( false == insert_result.second ) delete node; //重複で登録できなかった場合は確保したメモリを破棄
}
std::map<POINT, CNode*> mp;
for(NODE_POINTER_SET::const_iterator it=NodePointerSet2.begin(); it!=NodePointerSet2.end(); it++ ){
if( !mp[(*it)->position] ){
mp[(*it)->position] = (*it);
pair<NODE_POINTER_SET::iterator, bool> insert_result = NodePointerSet.insert((*it)); //setへ登録
}
}