Dynamic memory management

Smart pointers Smart pointers enable automatic, exception-safe, object lifetime management. Defined in header <memory> Pointer categories unique_ptr (C++11) smart pointer with unique object ownership semantics (class template) shared_ptr (C++11) smart pointer with shared object ownership semantics (class template) weak_ptr (C++11) weak reference to an object managed by std::shared_ptr (class template) auto_ptr (until C++17) smart pointer with strict

dynamic exception specification

Lists the exceptions that a function might directly or indirectly throw. Syntax throw(typeid, typeid, ...) (deprecated) This specification may appear only on lambda-declarator or on a function declarator that is the top-level (until C++17) declarator of a function, variable, or non-static data member, whose type is a function type, a pointer to function type, a reference to function type, a pointer to member function type. It may appear on the declarator of a parameter or on the decl

double

Usage double type: as the declaration of the type

do-while loop

Executes a statement repeatedly, until the value of condition becomes false. The test takes place after each iteration. Syntax attr(optional) do statement while ( expression ) ; attr(C++11) - any number of attributes expression - any expression which is contextually convertible to bool. This expression is evaluated after each iteration, and if it yields false, the loop is exited. statement - any statement, typically a compound statement, which is the body of the loop

do

Usage do-while loop: as the declaration of the loop

direct initialization

Initializes an object from explicit set of constructor arguments. Syntax T object ( arg ); T object ( arg1, arg2, ... ); (1) T object { arg }; T object { arg1, arg2, ... }; (2) (since C++11) T ( other ) T ( arg1, arg2, ... ); (3) static_cast< T >( other ) (4) new T(args, ...) (5) Class::Class() : member(args, ...) {... (6) [arg](){... (7) (since C++11) Explanation Direct initialization is performed in the following situations: 1) in

Destructors

A destructor is a special member function that is called when the lifetime of an object ends. The purpose of the destructor is to free the resources that the object may have acquired during its lifetime. Syntax ~ class_name (); (1) virtual ~ class_name (); (2) ~ class_name () = default; (3) (since C++11) ~ class_name () = delete; (4) (since C++11) attr(optional) decl-specifier-seq(optional) id-expression ( void(optional) ) except(optional) attr(optional) ; (5)

Destructible

Specifies that an instance of the type can be destructed. Requirements The type T satisfies Destructible if. Given. u, a expression of type T The following expressions must be valid and have their specified effects. Expression Post-conditions u.~T() All resources owned by u are reclaimed, no exceptions are thrown. Notes Destructors are called implicitly at the end of object lifetime such as when leaving scope or by the delete-expression. Explicit destructor call as shown in the

Derived classes

Any class type (whether declared with class-key class or struct) may be declared as derived from one or more base classes which, in turn, may be derived from their own base classes, forming an inheritance hierarchy. The list of base classes is provided in the base-clause of the class declaration syntax. The base-clause consists of the character : followed by a comma-separated list of one or more base-specifiers. attr(optional) access-specifier(optional) virtual-specifier(optional) class-or-dec

deque

This header is part of the containers library. Classes deque double-ended queue (class template) Functions operator==operator!=operator<operator<=operator>operator>= lexicographically compares the values in the deque (function template) std::swap(std::deque) specializes the std::swap algorithm (function template) Synopsis namespace std { #include <initializer_list> template <class T, class Allocator = allocator<T> > class de