Skip to content

refactor: use std range formatting instead of cth::str::to_string - #10

Merged
codethinki merged 2 commits into
masterfrom
refactor/std-range-format
Oct 6, 2026
Merged

codethinki merged 2 commits into
masterfrom
refactor/std-range-format

Conversation

@codethinki

Copy link
Copy Markdown
Owner

C++23 formats ranges of any formattable type (vector of CTH_FORMAT_CLASS types, nested ranges, map, set, pair, views, {:n}, {::}). The cth formatter (CTH_FORMAT_CPT(cth::str::printable_rng, cth::str::to_string)) predates that and took over every range:

  • strings were split into characters: vector<string>{"oaf", "farthest"} printed as cth::str::printable_rng{[[o, a, f], [f, a, r, t, h, e, s, t]]}
  • std range format specs like {::} did not compile

Removed the formatter, cth::str::to_string(range) and printable_rng with their tests. Nothing else in cth used them.

Lukas Thomann added 2 commits October 6, 2026 11:46
C++23 formats ranges of any formattable type. The cth formatter took over
every range, split strings into characters, prefixed the output with
cth::str::printable_rng and rejected the std range format specs.
Guards against cth taking over std range formatting again.
@codethinki
codethinki merged commit 932ab8f into master Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant