《Effective Modern C++》第0章学习记录

Acknowledgement

  • C++0x
  • C++11, C++14
  • Usenet newsgroup comp.std.c++
  • Stack Overflow
  • Overview of the New C++
  • Modern C++ Design
  • Going native
  • different blogs

Introduction

  • auto declarations
  • range-based for loops
  • lambda expressions
  • rvalue references
  • concurrency
  • nullptr
  • alias declarations
  • enums
  • smart pointer
  • moving objects
  • employ the features to create software that’s correct, efficient, maintainble, and portable

Terminology and Conventions

  • four official versions of C++
    • C++98, C++03, C++11, C++14
    • A useful heuristic to determine whether an expression is an lvalue is to ask if you can take its address.
    • move operations
      • move constructor
      • move assignment operator
    • copy operations
      • copy constructor
      • copy assignment
Widget(Widget&& rhs);
 // rhs is an lvalue, though it has an rvalue reference type
  • C++11 variadic templates
template<typename... T>
void processVals(const T&... params){}

Copies of rvalue are generally move constructed, while copies if lvalues are usually copy constructed.

  • arguments
  • parameters
  • perfect forwarding

Well-designed functions are exception safe, meaning they offer at least the basic exception safety guarantee (i.e., the basic guarantee)

  • program invariants

Functions offering the strong exception safety guarantee (i.e., the strong guarantee)

  • function object
  • non-member function
  • member function pointers
  • callable objects

Function objects created through lambda expressions are known as closures.

  • lambdas
  • function templates
  • tempate functions
  • class templates
  • template class

Declarations:

  • object declaration
  • class declaration
  • function declaration
  • scoped enum declaration

Definitions

  • object definition
  • class definition
  • function definition
  • scoped enum definition

Function’s signature

deprecates features

  • std::auto_ptr is deprecated in C++11
  • undefined behavior
    • beyond the index bounds of a std::vector
    • dereferencing an unintialized iterator
    • engaging in a data race
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值