zoukankan      html  css  js  c++  java
  • Effective Modern C++ 42 Specific Ways to Improve Your Use of C++11 and C++14

    1. Item 1: Understand template type deduction.

    2. Item 2: Understand auto type deduction.

    3. Item 3: Understand decltype.

    4. Item 4: Know how to view deduced types.

    5. Item 5: Prefer auto to explicit type declarations.

    6. Item 6: Use the explicitly typed initializer idiom when auto deduces undesired types.

    7. Item 7: Distinguish between () and {} when creating objects.

    8. Item 8: Prefer nullptr to 0 and NULL.

    9. Item 9: Prefer alias declarations to typedefs.

    10. Item 10: Prefer scoped enums to unscoped enums.

    11. Item 11: Prefer deleted functions to private undefined ones.

    12. Item 12: Declare overriding functions override.

    13. Item 13: Prefer const_iterators to iterators.

    14. Item 14: Declare functions noexcept if they won’t emit exceptions.

    15. Item 15: Use constexpr whenever possible.

    16. Item 16: Make const member functions thread safe.

    17. Item 17: Understand special member function generation.

    18. Item 18: Use std::unique_ptr for exclusive-ownership resource management.

    19. Item 19: Use std::shared_ptr for shared-ownership resource management.

    20. Item 20: Use std::weak_ptr for std::shared_ptr like pointers that can dangle.

    21. Item 21: Prefer std::make_unique and std::make_shared to direct use of new.

    22. Item 22: When using the Pimpl Idiom, define special member functions in the implementation file.

    23. Item 23: Understand std::move and std::forward.

    24. Item 24: Distinguish universal references from rvalue references.

    25. Item 25: Use std::move on rvalue references, std::forward on universal references.

    26. Item 26: Avoid overloading on universal references.

    27. Item 27: Familiarize yourself with alternatives to overloading on universal references.

    28. Item 28: Understand reference collapsing.

    29. Item 29: Assume that move operations are not present, not cheap, and not used.

    30. Item 30: Familiarize yourself with perfect forwarding failure cases.

    31. Item 31: Avoid default capture modes.

    32. Item 32: Use init capture to move objects into closures.

    33. Item 33: Use decltype on auto&& parameters to std::forward them.

    34. Item 34: Prefer lambdas to std::bind.

    35. Item 35: Prefer task-based programming to thread-based.

    36. Item 36: Specify std::launch::async if asynchronicity is essential.

    37. Item 37: Make std::threads unjoinable on all paths.

    38. Item 38: Be aware of varying thread handle destructor behavior.

    39. Item 39: Consider void futures for one-shot event communication.

    40. Item 40: Use std::atomic for concurrency, volatile for special memory.

    41. Item 41: Consider pass by value for copyable parameters that are cheap to move and always copied.

    42. Item 42: Consider emplacement instead of insertion.
  • 相关阅读:
    Window黑客编程之资源释放技术
    实战|一个表白墙引发的“血案”
    【T1543.003】利用 ACL 隐藏恶意 Windows 服务
    exe调用DLL的方式
    要点4:C的文件操作
    regsvr32 bypass windows defender 新思路
    使用Zolom内存解析运行python脚本(不落地)
    在不影响程序使用的情况下添加shellcode
    要点2:循环、条件控制
    要点3:输入函数对比与自定义输入方式
  • 原文地址:https://www.cnblogs.com/zxh1210603696/p/4178123.html
Copyright © 2011-2022 走看看