class Board {
public:
virtual void init() = 0;
virtual void print_board() const = 0;
virtual Board* clone() const = 0;
virtual bool less_than(const Board& b2) const = 0;
inline friend bool operator< (const Board& b1, const Board& b2);
};
inline bool operator< (const Board& b1, const Board& b2){
std::cout<<"TEST1"<<std::endl;
return b1.less_than(b2);
}
Test1 isn’t being printed at all when I insert using mymap[board] = evaluate;
The map is map<Board*, int>.
It’s calling
operator<(Board*, Board*), which just compares the pointers. Either construct your map asmap<Board, Board>– or create a functor for comparing two map pointers and use it as a template parameter:And