This is a rendering test for C++ code blocks.
Template-Heavy Code
template <typename T>
void swap(T& a, T& b) noexcept(
std::is_nothrow_move_constructible_v<T> &&
std::is_nothrow_move_assignable_v<T>)
{
T tmp = std::move(a);
a = std::move(b);
b = std::move(tmp);
}
Nested Angle Brackets
std::vector<std::pair<std::string, int>> entries;
std::unordered_map<std::string, std::vector<int>> index;
Inline Code in Prose
When you call push_back() on a std::vector<int>, the capacity
doubles from 8 to 16. The noexcept specifier on your move
constructor determines whether std::vector will move or copy
during reallocation.
| Growth Factor | Implementation | Memory Reuse |
|---|---|---|
| 2.0 | libstdc++, libc++ | Never reuses freed blocks |
| 1.5 | MSVC | Can reuse after a few rounds |