Initialization

Initialization of a variable provides its initial value at the time of construction. The initial value may be provided in the initializer section of a declarator or a new expression. It also takes place during function calls: function parameters and the function return values are also initialized. For each declarator, the initializer may be one of the following: ( expression-list ) (1) = expression (2) { initializer-list } (3) 1) comma-separated list of arbitrary expressi

INFINITY

Defined in header <cmath> #define INFINITY /*implementation defined*/ (since C++11) If the implementation supports floating-point infinities, the macro INFINITY expands to constant expression of type float which evaluates to positive or unsigned infinity. If the implementation does not support floating-point infinities, the macro INFINITY expands to a positive value that is guaranteed to overflow a float at compile time, and the use of this macro generates a compiler warnin

Increment/decrement operators

Increment/decrement operators increments or decrements the value of the object. Operator name Syntax Over​load​able Prototype examples (for class T) Inside class definition Outside class definition pre-increment ++a Yes T& T::operator++(); T& operator++(T& a); pre-decrement --a Yes T& T::operator--(); T& operator--(T& a); post-increment a++ Yes T T::operator++(int); T operator++(T& a, int); post-decrement a-- Yes T T::oper

Implicit conversions

Implicit conversions are performed whenever an expression of some type T1 is used in context that does not accept that type, but accepts some other type T2; in particular: When the expression is used as the argument when calling a function that is declared with T2 as parameter. When the expression is used as an operand with an operator that expects T2 When initializing a new object of type T2, including return statement in a function returning T2. When the expression is used in a switch

Implementation defined behavior control

Implementation defined behavior is controlled by #pragma directive. Syntax #pragma pragma_params (1) _Pragma ( string-literal ) (2) (since C++11) 1) Behaves in implementation-defined manner 2) Removes the L prefix (if any), the outer quotes, and leading/trailing whitespace from string-literal, replaces each \" with " and each \\ with \, then tokenizes the result (as in translation stage 3), and then uses the result as if the input to #pragma in (1) Explanation Pragma dire

if statement

Conditionally executes another statement. Used where code needs to be executed based on a run-time condition. Syntax attr(optional) if ( condition ) statement_true attr(optional) if ( condition ) statement_true else statement_false attr(C++11) - any number of attributes condition - one of expression which is contextually convertible to bool declaration of a single non-array variable with a brace-or-equals initializer. statement_true - any statement (often a

if

Usage if statement: as the declaration of the if statement

Identifiers

An identifier is an arbitrary long sequence of digits, underscores, lowercase and uppercase Latin letters, and Unicode characters. A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character). Identifiers are case-sensitive (lowercase and uppercase letters are distinct), and every character is significant. Note: C++ grammar formally requires Unicode characters to be escaped with \u or \U, but due to translation phase 1, that is exactly how

HUGE_VALF

Defined in header <cmath> #define HUGE_VALF /*implementation defined*/ (since C++11) #define HUGE_VAL /*implementation defined*/ #define HUGE_VALL /*implementation defined*/ (since C++11) The HUGE_VALF, HUGE_VAL and HUGE_VALL macros expand to positive floating point constant expressions which compare equal to the values returned by floating-point functions and operators in case of overflow (see math_errhandling). Constant Explanation HUGE_VALF Expands to

Hash

A Hash is a function object for which the output depends only on the input and has a very low probability of yielding the same output given different input values. Requirements The type T satisfies Hash if. The type T satisfies FunctionObject, CopyConstructible, Destructible, and Given. h, a value of type T or const T, whose argument type is Key k, a value of type convertible to Key or const Key u, an lvalue expression of type Key The following expressions must be valid and have t