Skip to content

C++23 modernization where it removes a real pain point #369

Description

@fpelliccioni

The codebase is built with `-std=c++23` (GCC 15 / apple-clang 17) but mostly written in pre-C++20 style. Don't do a mechanical sweep — pick concrete spots where a C++23 feature removes duplication, fixes a bug, or improves the API.

Where it pays off

  • Concepts at public boundaries — like the `HeaderLike`, `Timestamped` introduced in PR refactor(domain): turn header into an immutable value type #364. Use where they catch type-shape mismatches at compile time instead of opaque template errors.
  • `std::expected` — we already use `kth::expect`. Migrate once the project's minimum required compiler ships it cleanly across all targets; remove the in-tree shim.
  • `std::ranges` — `boost::adaptors` (reversed, transformed) is on the way out; ranges are first-class. Replace where it doesn't churn callers.
  • Deducing-this — only where const/non-const accessor pairs are exactly duplicated.
  • `std::flat_map` / `std::flat_set` — for hot tables that fit in cache; faster than `boost::unordered_flat_map` when N is small.
  • `if consteval` — for crypto / hash routines that should be `constexpr` only.

Where it's not worth it

  • `std::print` / `std::println` — we use spdlog everywhere; no win.
  • Multidimensional subscript — no use case here.
  • Sweeping `auto` → explicit return types or vice-versa — pure churn.

Acceptance

No standalone "modernize everything" PR. Each modernization is part of a refactor PR that already has a reason to touch that file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode refactoringroadmapPost-v1.0 roadmap items

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions