#include #include using namespace std; struct Value { int id; void *buf; Value (long l) { id = 4; buf = operator new(128); long *c = reinterpret_cast(buf); *c = l; } ~Value() { operator delete(buf); } }; bool operator< (const Value &v1, const Value &v2) { bool result = (*(reinterpret_cast(v1.buf))) < (*(reinterpret_cast(v2.buf))); return result; } bool operator== (const Value &v1, const Value &v2) { bool result = (*(reinterpret_cast(v1.buf))) == (*(reinterpret_cast(v2.buf))); return result; } typedef map Map; typedef Map::iterator ITR; int main() { Map m; ITR itr; Value s((long)10); m.insert(Map::value_type(s, "1")); Value s2((long)20); itr = m.find(s2); if(itr != m.end()) { cout << "Address found!" << endl; } }