I am trying to make a wrapper class based on the map class.
I need to use the object declared with the third typename parameter, "_Compare", in the base map class
"map<key, value, compare>"
I looked in the header for map and found "comp", but when I try to compile I get the message
"error" comp was not declared in this scope. What is the name of the object I am trying to use?
1 2 3 4 5 6 7 8 9 10 11 12 13
template <class T, class U, class C>
class Xmap : public map<T, U, C>
{
public:
Xmap(map<T, U> *s_ ) { comp.set(s_);}; // comp should be the declaired object of the compare class
~Xmap() {};
void set(map<T, U> *s_ )
{
clear();
compare.set(s_);
};
};
The object declared with this typename has a member called set that I need to be able to chance during execution of code.
¿What are you trying to do? ¿changing the comparison function in the middle of the game?
Besides that it will break everything, it could be a hard hack, because the map could be creating temporaries in order to perform the comparison.