C++11, BS book extract, part I, chapter 2

A declaration is a statement that introduces a name into the program. It specifies a type for the
named entity:
• A type defines a set of possible values and a set of operations (for an object).
• An object is some memory that holds a value of some type.
• A value is a set of bits interpreted according to a type.
• A variable is a named object.

curly-brace-delimited initializer lists saves you from conversions that lose information - narrowing conversions

use auto where we don’t have a specific reason to mention the type explicitly.

constexpr - compile time replacement for "define", meaning roughly ‘‘to be evaluated at compile time’’, keyword for variable or function. Such function can be called with non-constexpr parameters,
but at this case, return value will non-constexpr too.
To be constexpr, a function must be rather simple: just a return-statement computing a value.

range-for-statement - for (auto x : v)

nullptr

enum class - in opposite to plain old enum, it could not be converted into int.

static_assert - no surprise, just causes compile time errors if fails, example: static_assert(4<=sizeof(int), "integers are too small");


Advertisements