Skip to main content

26 docs tagged with "C++"

View All Tags

#if defined()

#if defined(SOMETHING) offers more flexibility than #ifdef SOMETHING.

<random>

Stephan T. Lavavej, rand() Considered Harmful (30min)

Deleted functions

You can delete functions to prevent them from beeing used. This is mostly used to prevent a type from being copied ; for example std::sharedptr.

friend

There are *very few* good reasons to use `friend`.

Smart Pointers

No naked new : this doesn't mean no dynamic allocations, it just means they should always be done through a smart pointer or a container.

The Rule of 5

C.21: If you define or =delete any copy, move, or destructor function, define or =delete them all.