Question

How come I could use the template class 'listmap' in this fashion.

In which, I could typedef listmap in .

typedef listmap<string,string> str_str_map;

The template of listmap is the following.

template <typename Key, typename Value, class Less=xless<Key>>
class listmap

I could see the strings are the correspondence to typename key, and typename value, but why is class Less not needed in the typedef?

Était-ce utile?

La solution

There is a default value for Less provided and it is the type xless<Key>. So if you do not provide the third parameter you will be using xless<string>(in your case).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top