c++ - 一段源码的注释,不知道它说的是什么意思(我会翻译,我说的是这句话该这么理解,不是让你们翻译的。。。。),?
阿神
阿神 2017-04-17 15:30:35
0
2
607

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.

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

阿神
阿神

闭关修行中......

membalas semua(2)
洪涛

粗体在这句话中的意义是:与标准库相符的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

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan