Error directive

Shows given message and renders program ill-formed. Syntax #error error_message Explanation After encountering #error directive, diagnostic message error_message is shown and the program is rendered ill-formed (the compilation is stopped). error_message can consist of several words not necessarily in quotes. See also C documentation for Error directive

EmplaceConstructible

Specifies that an object of the type can be constructed from a given set of arguments in uninitialized storage by a given allocator. Requirements The type T is EmplaceConstructible into the Container X (whose value_type is identical to T) from the arguments args if, given. A an allocator type m an lvalue of type A p the pointer of type T* prepared by the container args zero or more arguments where X::allocator_type is identical to std::allocator_traits<A>::rebind_allo

EqualityComparable

The type must work with == operator and the result should have standard semantics. Requirements The type T satisfies EqualityComparable if. Given. a, b, and c, expressions of type T or const T The following expressions must be valid and have their specified effects. Expression Return type Requirements a == b implicitly convertible to bool Establishes equivalence relation with the following properties: For all values of a, a == a yields true. If a == b, then b == a If a == b and

Empty base optimization

Allows the size of an empty base subobject to be zero. Explanation The size of any object or member subobject is required to be at least 1 even if the type is an empty class type (that is, a class or struct that has no non-static data members), in order to be able to guarantee that the addresses of distinct objects of the same type are always distinct. However, base class subobjects are not so constrained, and can be completely optimized out from the object layout: #include <cassert>

enumeration declaration

An enumeration is a distinct type whose value is restricted to one of several explicitly named constants ("enumerators"). The values of the constants are values of an integral type known as the underlying type of the enumeration. An enumeration is defined by enum-specifier, which appears in decl-specifier-seq of the declaration syntax. The enum-specifier has the following syntax: enum-key attr(optional) identifier(optional) enum-base(optional) { enumerator-list(optional) } (1) enum-key

enum

Usage declaration of an enumeration type

Elaborated type specifier

Elaborated type specifiers may be used to refer to a previously-declared class name (class, struct, or union) or to a previously-declared enum name even if the name was hidden by a non-type declaration. They may also be used to declare new class names. Syntax class-key class-name (1) enum enum-name (2) class-key attr(optional) identifier ; (3) class-key - one of class, struct, union class-name - the name of a previously-declared class type, optionally qualified

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_cast conversion

Safely converts pointers and references to classes up, down, and sideways along the inheritance hierarchy. Syntax dynamic_cast < new_type > ( expression ) new_type - pointer to complete class type, reference to complete class type, or pointer to (optionally cv-qualified) void expression - lvalue of a complete class type if new_type is a reference, prvalue of a pointer to complete class type if new_type is a pointer. If the cast is successful, dynamic_cast returns

else

Usage if statement: as the declaration of the alternative branch