Giter Site home page Giter Site logo

effective-modern-cpp's Introduction

  • 本书主要讲述了C++11/14新特性的用法,并深入地解析了其原理。
  • 01 理解模板类型推断
  • 02 理解auto类型推断
  • 03 理解decltype
  • 04 查看推断类型的方法
  • 05 使用auto替代显式类型声明
  • 06 auto推断出非预期类型时,使用explicitly typed initializer手法
  • 07 创建对象时注意区分()和{}
  • 08 使用nullptr替代0和NULL
  • 09 使用别名声明替代typedef
  • 10 使用限定作用域enum替代非限定作用域enum
  • 11 使用=delete替代private未定义函数
  • 12 将要重写的函数声明为override
  • 13 使用const_iterator替代iterator
  • 14 将不抛异常的函数声明为noexcept
  • 15 尽可能使用constexpr
  • 16 保证const成员函数线程安全
  • 17 理解特殊成员函数的生成机制
  • 18 对专属所有权的资源管理使用std::unique_ptr
  • 19 对共享所有权的资源管理使用std::shared_ptr
  • 20 使用std::weak_ptr替代可能空悬的std::shared_ptr
  • 21 使用std::make_unique和std::make_shared替代new
  • 22 使用pimpl手法时,将特殊成员函数定义在实现文件中
  • 23 理解std::move和std::forward
  • 24 区分转发引用和右值引用
  • 25 对右值引用使用std::move,对转发引用使用std::forward
  • 26 避免重载转发引用
  • 27 重载转发引用的替代方案
  • 28 理解引用折叠
  • 29 移动操作缺乏优势的情形:不存在、高成本、不可用
  • 30 完美转发的失败情形
  • 31 避免默认捕获模式
  • 32 使用初始化捕获将对象移入闭包
  • 33 对auto&&类型形参使用decltype来std::forward
  • 34 使用lambda替代std::bind
  • 35 使用std::async替代std::thread
  • 36 需要异步则指定std::launch::async
  • 37 让std::thread对象在所有路径上不可合并(unjoinable)
  • 38 注意多变的线程句柄析构函数行为
  • 39 对一次性事件通信使用void future
  • 40 对并发使用std::atomic,对特殊内存使用volatile
  • 41 对于可拷贝的形参,如果移动成本低且一定会被拷贝则考虑传值
  • 42 使用emplace操作替代insert操作

effective-modern-cpp's People

Contributors

downdemo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.