effective C++ 学习(Miscellany)

Miscellany

Item 53: Pay attention to compiler warnings.

1.     Sometimes warnings can exposeyour faults.

class B

{

public:

   virtual void f() const;

};

class D: public B

{

public:

   virtual void f();

};

Warning:D::f() hides virtual B::f()

Note: const is also the part of functionsign, so the f() in derived class D don’t redeclare f() in base class B.

Item 54: Familiarize yourself with the standard library,including TR1.

1.     The tr1::weak_ptrs can solvethe problem of cycle of the tr1::shared_ptr;

2.     The tr1::function is discussedin item 35;

The tr1::bind can make it achievedthat when a function is called, the bound objects is also called, which canreplace the pointer “this” in the member function.

3.     Hash tables are used to achievesets, multisets, maps and multi-maps;

4.     Regular expressions(正则表达式);

5.     Tuples (变量组),tr1::tuple can contain any numberof objects;

6.     The tr1::array is an array withthe style of STL, but its size is constant;

7.     The tr1::mem_fn is used toconstruct member function pointers;

8.     The tr1::reference_wrappermakes containers like contain references;

9.     Random number;

10.  Special math function, including Laguerre polynomial、Bessel functions、completeelliptic integrals;

11.  C99 Compatible extensions;

12.  Type traits, it provides types information during compiling,including judging whether the T is built-in types or not, whether to providevirtual functions, whether it is an empty class, whether it can be convertedinto other types;

13.  The tr1::result_of return the “return type” of function;

Item 55: Familiarize yourself with Boost.

1.     String and text processing;

2.     Containers;

3.     Function objects and seniorprogramming;

4.     Generic programming;

5.     Template metaprogramming, whichcan provide compile-time entities, like types list.

6.     Math and numerics;

7.     Correctness and testing;

8.     Data structure; type-safeunions and tuple;

9.     Inter-language support, allow seamlessinteroperability of C++ and python;

10. Memory; Pool and smartpointers.

11. CRC detection, date and timeprocessing, removing in file system;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值