문제

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