I am trying to write a class that inherits the std::map but I also want to overload one specific function while keeping the remaining inherited functions available for use. After reading a bit about that it seems you have to use the namespace of map to be able to use it's functions. However I had to use using std::map<K,V>::map;
for it to be working. My question is what is the last ::map
? Is it the name of the namespace of map? But if we take cout for example you simply needed using cout;
. Also how does one know the name of the namespaces i stl?
The code looks something like this:
#include <map>
template<typename K,typename V>
class my_map : public std::map<K,V>
{
private:
/* data */
public:
using std::map<K,V>::map;
};