What C++ idioms should C++ programmers use? [closed]

What C++ idioms should C++ programmers know?

By C++ idioms, I mean design patterns or way of doing certain things that are only applicable for C++ or more applicable for C++ than most other languages.

Why one should use the idioms, and what do the idioms accomplish?


Solution 1:

By far the single most important "pattern" to learn and know that's (nearly) unique to C++ is RAII (Resource Acquisition Is Initialization).

Edit: (To answer extra question edited into the question). You use RAII primarily to (semi-)automate resource management. The most obvious use is freeing resources owned by objects when the owning objects go out of scope, such as freeing memory or closing files.

Solution 2:

Here is one list. If I had to pick a couple I might go with the Curiously Recurring Template Pattern or Virtual Contstructors.