这个问题重点关注模板元编程结构。我找到了两篇文章(一篇 和两个,但是两个没有显示确凿的证据,但我相信这些声明)提供的证据表明 c++0x 原型编译器将指数编译时间转变为线性编译时间。
我有一个模糊的预感,auto、decltype 和可变参数模板将有一些东西是这方面的推动者。我希望看到的是对实现这一点的语言和编译器技术的变化的全面解释,特别是解释如何和为什么。
就我的技术水平而言,我在愤怒中使用过Boost TMP库精神,以及一些玩具MPL程序。
This question focuses on template metaprogramming constructs. I have found two articles (one and two, two however doesn't show hard evidence, but I trust the claims) that provide a evidence showing that c++0x prototype compilers turn exponential compilation times to linear compilation times.
I have a vague inkling that auto, decltype and variadic templates will have something are enablers of this. What I would like to see is ground up explanation of the changes to the languages and the compiler technologies that enable this, especially explaining the how and why.
In terms of my skill level, I have used the boost TMP library spirit in anger, and some toy MPL programs.
发布评论
评论(1)
很明显,第一个编译器的处理速度比第二个慢,就像你说的, 证据。
我知道 C++ 中没有完全通用的
auto
解决方法。模拟auto
需要数百甚至数千行代码(请参阅 boost.typeof),但它仍然不是通用的。与 decltype 相同。It's clear that the first is slower to process for the compiler than the second and there is, like you say, evidence for that.
I know of no workaround for a completely generic
auto
in C++. Simulatingauto
requires hundreds if not thousands of lines of codes (see boost.typeof) and then it's still not generic. Same fordecltype
.