Below is an opinionated, “big-picture” tour of how mainstream, professional C++ has shifted since the C++03 era (~2008) to modern C++20/23.
The goal is not an exhaustive language changelog, but to paint the style & design-philosophy delta—i.e. what you were taught was “good C++” then, vs. what’s considered idiomatic, safe, and expressive now.
1-Page Cheat-Sheet
Area Typical circa 2008 (“Old C++”) Modern recommendation (C++17/20/23) Why it changed Resource mgmt. new / delete, manual try/catch for leaksRAII everywhere; std::unique_ptr, std::shared_ptr, std::lock_guard, std::span Automatic, exception-safe cleanup; Rule of Zero/Five Containers & algos Hand-written loops, std::vector most of the time std::array, std::deque, std::unordered_*, <algorithm> + ranges (std::views::filter)Less code, fewer bugs, cache-friendly Loops for (size_t i = 0; i < vec.size(); ++i)Range-based for or algorithms Reads intent, avoids off-by-one Type deduction Write the type auto, CTAD, decltype(auto)DRY, resist refactor bugs String handling char*, std::string copiesstd::string_view, fmt::format, constexpr stringsZero-copy, safe formatting Copy semantics “Rule of Three” Rule of Zero or Five; move semantics Avoid manual memory mgmt., cheap moves Concurrency pthreads / platform APIs std::thread, std::async, std::jthread, coroutinesPortable, composable cancellation Build/ABI Header files, precompiled headers Modules , CMake + Conan/vcpkgScale, faster builds, reproducible deps Error handling Return codes, bool ok Exceptions or std::expected (P0323) style Expressive, can’t ignore easily Compile-time code Template metaprogramming (TMP) black-magic constexpr, consteval, std::is_constant_evaluatedReadable, debuggable, fast Macros #define MAX(a,b) constexpr, inline constexpr, enum classScoped, typed, debug-friendly Enums Unscoped enum Color { RED } enum class Color { Red }No name pollution, strong typing Interfaces Pure virtuals, pImpl Concepts, type-erased wrappers (std::function, std::any, std::variant) Clear constraints, less boilerplate Testing & tooling Hand-rolled asserts Sanitizers, Clang-Tidy, Catch2/GTest, static analyzers Early bug finding, CI-friendly
2. Idiom Shifts In Depth
2.1 Resource Management: Rule of Zero/Five vs Rule of Three
Old:
cpp Copy code
class Image {
Image(const Image&); // copy-ctor
Image& operator=(const Image&); // copy-assign
~Image(); // manual delete[]
};
Modern:
cpp Copy code
class Image {
public:
Image() = default;
private:
std::vector<std::byte> data_; // manages itself
}; // no destructor, no copy-ops => Rule of Zero
If you do need ownership polymorphism (rare), do it once:
cpp Copy code
std::unique_ptr<Base> p = std::make_unique<Derived>();
2.2 Expressive Algorithms & Ranges
Old:
cpp Copy code
std::vector<int> odds;
for (auto x : numbers)
if (x % 2) odds.push_back(x);
std::sort(odds.begin(), odds.end());
Modern:
cpp Copy code
auto odds_sorted = numbers | std::views::filter([](int x){return x & 1;})
| std::ranges::to<std::vector>();
std::ranges::sort(odds_sorted);
No indices, no end iterators, composable views, and the compiler can fuse loops.
2.3 Move Semantics
Move turns costly copies into cheap pointer swaps.
cpp Copy code
std::vector<std::string> v;
v.push_back(buildHugeString()); // pre-C++11: copies
v.push_back(std::move(hugeString)); // C++11+: moves
2.4 Type Erasure & std::variant
Instead of inheritance everywhere:
cpp Copy code
std::vector<std::unique_ptr<Shape>> shapes;
you can often do:
cpp Copy code
std::vector<std::variant<Circle, Square, Triangle>> shapes;
std::visit([](auto& s){ draw(s); }, shapes[i]);
No vtable, often smaller & faster.
2.5 Compile-time Power (constexpr Everywhere)
• Pre-C++11: only integral consts were legal at compile-time.
• Now: whole parsers, JSON, regex, image data can be validated in constexpr.
cpp Copy code
constexpr auto table = make_lookup_table();
static_assert(table["blue"] == Color::Blue);
2.6 Concurrency & Coroutines
From:
cpp Copy code
pthread_create(&tid, nullptr, run, &arg);
To:
cpp Copy code
std::jthread t(do_work); // RAII join/cancel
And async generators:
cpp Copy code
task<std::string> read_lines(File f);
for co_await (auto&& line : read_lines(file)) { … }
2.7 Safer “string-y” Code
Old:
cpp Copy code
void log(const std::string& msg);
Modern:
cpp Copy code
void log(std::string_view msg); // accepts literals, string, span<char>
Use fmt::print("coords = ({}, {})\n", x, y); instead of printf or ostringstream.
3. Style & Guidelines
Follow the C++ Core Guidelines (Stroustrup & Sutter) – enforced by clang-tidy -checks=cppcoreguidelines-*.
Prefer value semantics : pass/return by value, let the compiler optimize (NRVO, moves).
Make data members private or public & struct; skip “trivial” getters/setters.
Favor immutability (const, constexpr, span<const T>).
Minimal include surface → use forward declarations, now modules .
Enable warnings + sanitizers (-Wall -Wextra -Werror -fsanitize=address,undefined).
Treat nullptr, std::optional, std::expected as self-documenting states instead of magic values.
4. Build & Packaging
• Then: hand-written makefiles, precompiled headers.
• Now: CMake, Ninja, continuous integration, Conan/vcpkg for deps, and C++20 Modules (import std;).
5. “Is Old Code Wrong?”
Not necessarily. Good C++03 (RAII, STL, exception-safe) is still pretty good.
Modern C++ mainly:
• Removes boilerplate (auto, range-for, concepts)
• Adds safety nets (smart pointers, span, string_view, sanitizers)
• Provides higher-level abstractions (coroutines, ranges, modules)
You can incrementally modernize: enable -std=c++20, run clang-tidy modernize checks, replace raw pointers with smart ones, introduce auto, move-only types, then adopt ranges & coroutines where they make sense.
Happy modern C++-ing! 🚀