0x341 C++

C

C++

Main interface reference is Bjarne Stroustrup’s C++ Programming Language 3rd edition and the C++ standard. This section will be based on the style in the book.

Main implementation reference will be llvm libc++ implementation

A History of C++

Abstraction

Standard Library

Concurrency

  • std::thread: it needs to join or detach. use RAII to make sure it will be handled correctly.
  • std::mutex: RAII with std::lock_guard or std::unique_lock(can lock multiple mutex and unlock)
  • std::recursive_mutex: allow a thread to acquire a mutex multiple times without deadlock

STL Container

  • not thread-safe

Algorithm

  • sort: looks optimized using different sort (insertion <-> quick) when length is short or long

Standardization

C++11 (C++0x)

  • lambda expression

C++14

C++17

C++20

Generic Programming:

  • concept, constraint