[1] Don’t reinvent the wheel; use libraries.
[2] Don’t believe in magic; understand what your libraries do, how they do it, and at what cost
they do it.
[3] When you have a choice, prefer the standard library to other libraries.
[4] Do not think that the standard library is ideal for everything.
[5] Remember to #i n c l u d e the headers for the facilities you use; §3.3.
[6] Remember that standard library facilities are defined in namespace s t d ; §3.3.
[7] Use s t r i n g rather than c h a r *; §3.5, §3.6.
[8] If in doubt use a rangechecked
vector (such as V e c ); §3.7.2.
[9] Prefer v e c t o r <T >, l i s t <T >, and m a p <k e y ,v a l u e > to T []; §3.7.1, §3.7.3, §3.7.4.
[10] When adding elements to a container, use p u s h _ b a c k () or b a c k _ i n s e r t e r (); §3.7.3, §3.8.
[11] Use p u s h _ b a c k () on a v e c t o r rather than r e a l l o c () on an array; §3.8.
[12] Catch common exceptions in m a i n (); §3.7.2.

posted on 2013-07-01 13:29  秋天里的红苹果  阅读(125)  评论(0编辑  收藏  举报