开发者

Templates and headers

So do any of the future standards of c++ plan to resolve the issue of having to c开发者_运维技巧ombine the declaration and implementation?


There's a very good reason why the template implementation needs to go into the header. A template is not code - it's only a template for the automatic generation of code. The code doesn't get created until you try to use it with the template parameters filled in. The compiler needs to have the full template body in order to fill in the blanks and get working code.


C++0x does not. Other future standard versions haven't even begun being drafted yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜