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

STL overview

Headers

copy(), find(), sort()
array
duration, time_point
sqrt(), pow()
complex, sqrt(), pow()
fstream, ifstream, ofstream
future, promise
istream, ostream, cin, cout

map, multimap
unique_ptr, shared_ptr, allocator
default_random_engine, normal_distribution
regex, smatch
string, basic_string
set, multiset
istrstream, ostrstream
thread
unordered_map, unordered_multimap
move(), swap(), pair
vector

Containers

array A fixed-size array
vector A variable-size vector
list A doubly-linked list
forward_list A singly-linked list
deque A double-ended queue
set A set
multiset A set in which a value can occur many times
map An associative array
multimap A map in which a key can occur many times
unordered_map A map using a hashed lookup
unordered_multimap A multimap using a hashed lookup
unordered_set A set using a hashed lookup
unordered_multiset A multiset using a hashed lookup

unique_ptr to represent unique ownership
shared_ptr to represent shared ownership

Advertisements

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

The std::initializer_list used to define the initializer-list constructor is a standard-library type known to the compiler

A class hierarchy offers two kinds of benefits:
Interface inheritance: An object of a derived class can be used wherever an object of a base class is required.
Implementation inheritance: A base class provides functions or data that simplifies the implementation of derived classes.

The =delete mechanism is general, that is, it can be used to suppress any operation

The notation [&](int a){ return a<x; } is called a lambda expression
Had we wanted to ‘‘capture’’ only x by reference, we could have said so: [&x]. Had we wanted to give the generated object a copy of x, we could have said so: [=x]. Capture nothing is [], capture all local names used by reference is [&], and capture all local names used by value is [=].

A template can be defined to accept an arbitrary number of arguments of arbitrary types. Such a template is called a variadic template.
template<typename T, typename… Tail>
void f(T head, Tail… tail)
{
g(head); // do something to head
f(tail…); // tr y again with tail
}
void f() { } // do nothing

using instead of typedef – using size_t = unsigned int;