+=== Common {cpp} code
+
+Many parts of the project need common {cpp} code. You'll find all of it
+under `src/cpp-common`.
+
+In general, anything under a namespace named `internal` is internal to
+the API containing it. For example, everything under the `bt2::internal`
+namespace is internal to the `bt2` namespace and therefore isn't meant
+to be used outside the `src/cpp-common/bt2` directory.
+
+==== `bt2`: libbabeltrace2 {cpp} bindings
+
+`src/cpp-common/bt2` contains our internal {cpp} bindings of
+the libbabeltrace2 C{nbsp}API, under the `bt2` namespace.
+
+Those bindings are designed to have, as much as possible, no performance
+impact. Anything which inherits `bt2::BorrowedObject` contains a single
+libbabeltrace2 object pointer.
+
+Pass and return borrowed objects _by value_ (copy).
+
+In general, the following holds:
+
+[options="header,autowidth",cols="2"]
+|===
+|{cpp} expression
+|Equivalent C{nbsp}expression
+
+|`bt2::Xyz`
+|`bt_xyz *`
+
+|`const bt2::Xyz`
+|`bt_xyz * const`
+
+|`bt2::ConstXyz`
+|`const bt_xyz *`
+
+|`const bt2::ConstXyz`
+|`const bt_xyz * const`
+|===
+
+==== `bt2c`: general common {cpp} code
+
+Similar to the role of `src/common` for C code.
+
+In general, everything in here is under the `bt2c` namespace.
+
+Notable files are:
+
+`align.hpp`::
+ The `bt2c::align()` function template: a wrapper of
+ `src/common/align.h`.
+
+`c-string-view.hpp`::
+ The `bt2c::CStringView` class: a view on a constant null-terminated
+ C{nbsp}string.
++
+We have this because `bt2s::string_view` doesn't imply null termination,
+only a beginning and a length.
++
+A `bt2c::CStringView` instance is convertible to `const char *` and may
+be empty (the underlying pointer is null).
+
+`call.hpp`::
+ The `bt2c::call()` function template: a partial implementation of
+ https://en.cppreference.com/w/cpp/utility/functional[INVOKE].
++
+We use this mostly to assign the result of calling an immediately
+invoked function expression (lambda) to an `auto` variable without
+risking to assign the lambda itself, should we forget the calling
+parentheses:
++
+[source,cpp]
+----
+const auto res = bt2c::call([&] {
+ /* Complex initialization */
+});
+----
+
+`endian.hpp`::
+ Typed wrappers of `src/compat/endian.h`.
+
+`exc.hpp`::
+ Common exception classes.
+
+`fmt.hpp`::
+ Common https://fmt.dev/[{fmt}] formatters.
+
+`logging.hpp`::
+ The `bt2c::Logger` class and helper `BT_CPPLOG*()` macros for any
+ {cpp} logging.
++
+When possible, prefer using this over the C{nbsp}logging API.
++
+One important benefit is that this API uses {fmt} to format the logging
+message instead of `vsnprintf()`.
+
+`prio-heap.hpp`::
+ The `bt2c::PrioHeap` class template: an efficient heap data
+ structure.
+
+`read-fixed-len-int.hpp`::
+ The function templates `bt2c::readFixedLenInt()`,
+ `bt2c::readFixedLenIntLe()`, and `bt2c::readFixedLenIntBe()`: read a
+ fixed-length integer from a byte buffer.
+
+`safe-ops.hpp`::
+ The `bt2c::safe*()` function templates: arithmetic operations which
+ assert that there's no possible overflow.
+
+`std-int.hpp`::
+ The `bt2c::StdIntT` type alias template: becomes one of the
+ `std::*int*_t` types depending on its parameters.
++
+For example, `bt2c::StdIntT<32, true>` is `std::int32_t`.
+
+`type-traits.hpp`::
+ Common type traits.
+
+`uuid.hpp`::
+ The following classes:
+
+`bt2c::Uuid`:::
+ Container of a 16-byte
+ https://en.wikipedia.org/wiki/Universally_unique_identifier[UUID].
++
+Provides the static `generate()` method as well as conversion to
+`bt2c::UuidView`.
+
+`bt2c::UuidView`:::
+ View on a UUID (not a container).
++
+Provides byte access, comparison, as well as string conversion methods.
++
+Also provides conversion to `bt2c::Uuid`.
+
+`vector.hpp`::
+ The `bt2c::vectorFastRemove()` function template: remove an element
+ from an `std::vector` instance quickly when the order isn't
+ important.
+
+==== `bt2s`: drop-in replacements of {cpp}14 to {cpp}20 STL features
+
+Everything under the `bt2s` namespace has its equivalent under the `std`
+namespace, but in {cpp} versions we don't yet have access to, namely:
+
+`make_unique.hpp`::
+ `bt2s::make_unique()`, a drop-in replacement of `std::make_unique()`
+ ({cpp}14).
+
+`optional.hpp`::
+ Drop-in replacement of the `std::optional` API ({cpp}17).
+
+`span.hpp`::
+ Drop-in replacement of the `std::span` API ({cpp}20).
+
+`string-view.hpp`::
+ Drop-in replacement of the `std::string_view` API ({cpp}17).
+
+==== `vendor`: copies of {cpp} dependencies
+
+This directory contains copies of the source code of {cpp} dependencies
+to avoid packaging issues.
+
+They are:
+
+`fmt`::
+ https://fmt.dev/[{fmt}].
+
+`nlohmann`::
+ https://json.nlohmann.me/[JSON for Modern C++].
+
+`optional-lite`::
+ https://github.com/martinmoene/optional-lite[optional lite].
++
+IMPORTANT: Use the symbols of `src/cpp-common/bt2s/optional.hpp`, under
+the `bt2s` namespace, instead of using this directly.
+
+`span-lite`::
+ https://github.com/martinmoene/span-lite[span lite].
++
+IMPORTANT: Use the symbols of `src/cpp-common/bt2s/span.hpp`, under the
+`bt2s` namespace, instead of using this directly.
+
+`string-view-lite`::
+ https://github.com/martinmoene/string-view-lite[string_view lite].
++
+IMPORTANT: Use the symbols of `src/cpp-common/bt2s/string-view.hpp`,
+under the `bt2s` namespace, instead of using this directly.
+