搜索

首页  >  问答  >  正文

c++ - 一段源码的注释,不知道它说的是什么意思(我会翻译,我说的是这句话该这么理解,不是让你们翻译的。。。。),?

Note that standard-conforming allocators use many language features that are not yet widely implemented. In particular, they rely on member templates, partial specialization, partial ordering of function templates, the typename keyword, and the use of the template keyword to refer to a template member of a dependent type.

就是加粗部分,求解释,想不明白。

阿神阿神2804 天前605

全部回复(2)我来回复

  • PHP中文网

    PHP中文网2017-04-17 15:32:35

    粗体在这句话中的意义是:与标准库相符的allocator依赖于"partial ordering of function templates"和"the use of the template keyword to refer to a template member of a dependent type"这两个c++特性。

    partial ordering实际上用了模板就要走一遍,template关键字用在allocator的rebind上。这句话想说实现与标准相符的allocator没办法避开这些特性,但是这些特性目前移植性不好。(参考一下注释的年份,我在某cryengine里找到了相同的注释,最后更新于2012年)

    When the same function template specialization matches more than one overloaded function template (this often results from template argument deduction), partial ordering of overloaded function templates is performed to select the best match.[...]

    参照 Function template overloading

    Similarly, in a template definition, a dependent name that is not a member of the current instantiation is not considered to be a template name unless the disambiguation keyword template is used or unless it was already established as a template name:[...]

    参照 The template disambiguator for dependent names

    回复
    0
  • PHPz

    PHPz2017-04-17 15:32:35

    回复
    0
  • 取消回复