EDIT: SOLVED!
Hi
once again i need your help.
I have a struct representing a poker hand category.
I want to precalculate the equity of every category against every category. Hence i want to make a table:Code:typedef struct{ int rank1; int rank2; bool isSuited; }HAND169;
Now, if i want to work with this map, the compiler desires a comparison function from me. But i really have no clue how to implement it. I dont understand the example at http://www.cplusplus.com/reference/stl/map/map/ and the numerous articles in the web did not help me. Can you please help me with it?Code:typedef map<HAND169, map<HAND169, pair<double,double>>> LOOKUP1ON1;
EDIT: SOLUTION
Forgot the inner map. Anyway thanks for reading ;-DCode:typedef struct{ int rank1; int rank2; bool isSuited; }HAND169; struct classcomp { bool operator() (const HAND169 &h1, const HAND169 &h2) const { if (h1.rank1 < h2.rank1) return true; else if (h1.rank1 == h2.rank1 && h1.rank2 < h2.rank2) return true; else if (h1.rank1 == h2.rank1 && h1.rank2 == h2.rank2 && h1.isSuited < h2.isSuited) return true; return false; } }; typedef map<HAND169, map<HAND169, pair<double,double>,classcomp>, classcomp> LOOKUP1ON1 ;


Reply With Quote