Operator Precedence

The following table lists the precedence and associativity of C++ operators. Operators are listed top to bottom, in descending precedence. Precedence Operator Description Associativity 1 :: Scope resolution Left-to-right 2 ++ -- Suffix/postfix increment and decrement type() type{} Functional cast () Function call [] Subscript . -> Member access 3 ++ -- Prefix increment and decrement Right-to-left + - Unary plus and minus ! ~ Logical NOT an

operator overloading

Customizes the C++ operators for operands of user-defined types. Syntax Overloaded operators are functions with special function names: operator op (1) operator type (2) operator new operator new [] (3) operator delete operator delete [] (4) operator "" suffix-identifier (5) (since C++11) op - any of the following 38 operators:+ - * / % ˆ & | ~ ! = < > += -= *= /= %= ˆ= &= |= << >> >>= <<= == != <= >= &&

operator

Usage declaration of an overloaded operator

offsetof

Defined in header <cstddef> #define offsetof(type, member) /*implementation-defined*/ The macro offsetof expands to a constant of type std::size_t, the value of which is the offset, in bytes, from the beginning of an object of specified type to its specified member, including padding if any. If type is not a standard layout type, the behavior is undefined. If member is a static member or a member function, the behavior is undefined. The offset of the first member of a stand

Object lifetime

Every object has a lifetime, which is a runtime property: for any object, there is a moment during the execution of a program when its lifetime begins, and there is a moment when it ends. For objects of class or aggregate types that are initialized by anything other than the trivial default constructor, lifetime begins when initialization ends. For objects of class types whose destructor is not trivial, lifetime ends when the execution of the destructor begins. For all other objects (class

Object

C++ programs create, destroy, refer to, access, and manipulate objects. An object, in C++, is a region of storage that has. size (can be determined with sizeof) alignment requirement (can be determined by alignof) storage duration (automatic, static, dynamic, thread-local) lifetime (bounded by storage duration or temporary) type value (which may be indeterminate, e.g. for default-initialized non-class types) optionally, a name Functions, references, classes and other types, name

NumericType

Specifies that the type can be used as the template argument of std::valarray. Requirements for a type T to be an NumericType: T cannot be a reference T cannot be cv-qualified If T is a class, it does not overload operator& has no pure virtual member functions (is not abstract) has a public default constructor has a public copy constructor T::T(const T&) has a public destructor has a public assignment operator T& T::operator=(const T&) or T& T::operator=

Numerics library

The C++ numerics library includes common mathematical functions and types, as well as optimized numeric arrays and support for random number generation. Common mathematical functions The header cmath provides standard C library mathematical functions such as std::fabs, std::sqrt, and std::sin. Complex numbers Defined in header <complex> complex a complex number type (class template) Numeric arrays Defined in header <valarray> valarray numeric arrays and arr

numeric

This header is part of the numeric library. Functions iota (C++11) fills a range with successive increments of the starting value (function template) accumulate sums up a range of elements (function template) inner_product computes the inner product of two ranges of elements (function template) adjacent_difference computes the differences between adjacent elements in a range (function template) partial_sum computes the partial sum of a range of elements (function te

nullptr

Usage nullptr pointer literal (since C++11)