C++11, BS book extract, part II, chapter 7 + 8 +9 + 10 + 11

nullptr instead of NULL

raw string literalsR”(ccc)” notation for a sequence of characters ccc, for wchar_t – it is LR”(angst)”, u8 – UTF8, u – UTF16,  U – UTF32, can be combined with R as well.

Reference to reference can only happen as the result of an alias  or a template type argument.

 Unqualified Lists – {} are used besides initialization a variable

  • A function argument
  • A return value
  • The right-hand operand of an assignment operator ( = , += , ∗= , etc.)
  • A subscript

 

A lambda expression consists of a sequence of parts:

  • A possibly empty capture list
  • An optional parameter list
  • An optional mutable specifier
  • An optional noexcept specifier
  • An optional return type declaration of the form −> type
  • A body, specifying the code to be executed. The body is delimited by {}

Lambda capture list can be –

  • [] : an empty capture list (no captures).
  • [&] : implicitly capture by reference (all local names)
  • [=] : implicitly capture by value (all local names)
  • [ capture-list ] : explicit capture
  • [&, capture-list ] : implicitly capture by reference all local variables with names not mentioned in the list
  • [=, capture-list ] : implicitly capture by value all local variables with names not mentioned in the list

A lambda that captures nothing can be assigned to a pointer to function of an appropriate type

Advertisements

About DmitryKrinitsyn
Software developer and muay thai adept

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: