Basic C++ Idioms / Techniques

前端 未结 6 1405
闹比i
闹比i 2021-02-02 01:21

Note: marked as community wiki.

In recent days, I\'ve realized how little I know about C++.

Besides:

  • using the STL
  • implementing RAII
6条回答
  •  青春惊慌失措
    2021-02-02 01:41

    Basic:

    • RTTI
    • Virtual functions
    • shared_ptr etc
    • Templates
    • Virtual inheriting
    • Variadic macros

    Also useful:

    • Attributes (it depends on your compiler)
    • Variadic templates
    • Variadic functions
    • Constexpr (sorting in compile time / calculating hash of strings etc... but the latter is related to the last section)
    • Lambdas

    Useful for brainfucking or in special cases:

    • CRTP
    • SFINAE
    • inable_if (type traits)
    • Foreach macro
    • User-defined literals

提交回复
热议问题