質問

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?

役に立ちましたか?

解決

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).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top