博客统计信息

51cto推荐博客
用户名:virus
文章数:459
评论数:276
访问量:740380
无忧币:3049
博客积分:6424
博客等级:8
注册日期:2006-09-29

我的技术圈(1)

更多>>
tips on c++
2007-06-10 22:56:26
标签:c++ 休闲 职场
[1]Use templates to express algorithms that apply to many argument types;
[2]Use templates to express containers;
[3]Provide specializations for containers of pointers to minimize code size;
[4]Always declare the general form of a template before specializations;
[5]Declare a specialization before its use;
[6]Minimize a template definition's dependence on its instantiation contexts;
[7]Define every specialization you declare;
[8]Consider if a template needs specializations for C-style strings and arrays;
[9]Parameterize with a policy object;
[10]USe specialization and overloading to provide a single interface to implementations of the same concept for different types;
[11]Provide a simple interface for simple cases and use overloading and default arguments to express less commom cases;
[12]Debug concrete examples before generalizing to a template;
[13]Remember to export template definitions that need to be accessible from other translation units;
[14]Seperately compile large templates and templates with nontrival context dependencies;
[15]Use templates to express conversions but define those conversions very carefully;
[16]Where necessary,constrain template arguments using a constraint() member function;
[17]Use explicit instantiation to minimize compile time and link time;
[18]Prefer a template over derived classes when run-time efficiency is at a premium;
[19]Prefer derived classes over a template if adding new variants without recompilation is important;
[20]Prefer a template over derived classes when no common base can be defined;
[21]Prefer a template over derived classes when bulit-in types and structures with compatibility constraints are important;
分享至
更多
一键收藏,随时查看,分享好友!
langtaotian123
1人
了这篇文章
类别:CppGameProgram技术圈()┆阅读()┆评论() ┆ 推送到技术圈返回首页
上一篇 读书札记 下一篇 TIPS

文章评论

 
2011-07-16 13:05:29
<link ><img >

 

发表评论            

【技术门诊】专家解析:软考重点难点及应试技巧
昵  称:
登录  快速注册
验证码:

请点击后输入验证码博客过2级,无需填写验证码

内  容: