开发者

Templates and headers

开发者 https://www.devze.com 2023-03-16 20:25 出处:网络
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 ne

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

精彩评论

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

关注公众号