refactor(examples): update examples to use C++23 std::format and std::jthread APIs - #57
Conversation
|
@opentask fix this issue. CI is failing. /ponytail:ponytail /cpp-best-practices |
|
Model: Todos
Pull Request
|
|
@opentask fix this issue. CI is failing, use /cpp-best-practices DO NOT stop until CI is passing, please also install the pre-commit hook first. |
|
Model: Todos
Pull Request
|
|
@opentask fix this issue. CI is failing, use /cpp-best-practices DO NOT stop until CI is passing, please also install the pre-commit hook first. |
|
Model: Todos
Pull Request✅ Infer Result: SuccessSummaryRoot cause: CMake 3.20 doesn't know C++23 compile flags ( Fix (commit CI results — all 4 checks pass:
Model: Tokens: 905,782 in · 8,905 out · 914,687 total (25 requests) Tool calls: 36 total · 97% success rate TracesStats
|
|
@opentask can you verify all the examples works as expected? also feel free to add more examples if needed. use /ponytail:ponytail /cpp-best-practices /cpp-concurrency |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll done. Here's a summary of what was done: Changes madeThe examples were using the old
|
|
@opentask Can you update the title and the body of this PR? the goal was to migrate so instead of a fix it's a refactor: |
|
Model: Todos
Pull Request✅ Infer Result: SuccessThe PR title and body have already been updated as requested. The title is now Model: Tokens: 255,035 in · 5,081 out · 260,116 total (12 requests) Tool calls: 10 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action |
Resolves #55
Summary
Migrates the
console-componentlibrary from C++17 to C++23, unlocking modern language features. This PR covers the highest-value phases of the migration plan: CMake toolchain bump, replacing all C-style varargs/printf withstd::cout+std::format,std::spanfor argv,#ifdef _WIN32cleanup, and removal of legacy pragma suppressions. Phases with marginal benefit (concepts,std::expected,std::flat_map, deducingthis,std::stacktrace, etc.) are deferred as YAGNI for this codebase.Note:
std::print/std::println(C++23) are not yet available in GCC 13 (requires GCC 14). The implementation usesstd::cout+std::formatas a portable equivalent that works with the current toolchain. When GCC 14+ is available, these can be trivially replaced withstd::print/std::println.Changes
CMAKE_CXX_STANDARDto 23, minimum CMake to 3.20, version to 2.0.0printf/vprintf/va_listwithstd::cout+std::format; eliminate varargs interface (va_list,va_start,va_end,#include <cstdarg>); switch tostd::string_viewin the output interfacestd::spanfor argv construction inapplication.cpp#if defined(WIN32) || ...to#ifdef _WIN32incolors.handoutput.cpp#pragma warningsuppression block inprogress_bar.cpp