C ++模板类澄清

用户名

我怎么能以这种方式使用模板类“ listmap”。

在其中,我可以在中输入typedef listmap。

typedef listmap<string,string> str_str_map;

listmap的模板如下。

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

我可以看到字符串是与typename键和typename值的对应关系,但是为什么在typedef中不需要class Less?

伊娃(Ivaylo Strandjev)

Less提供了一个默认值,它是type xless<Key>因此,如果您不提供第三个参数,则将使用xless<string>(针对您的情况)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章