u/Dooez

We have colored functions at home
▲ 142 r/cpp

We have colored functions at home

C++26 introduces new special functions that when used as default arguments allow to query call location, similar to `std::source_location::current()`.
Using one of these functions, e.g. `std::meta::current_function`, caller function reflection can be acquired and inspected.
This allows to implement basic function coloring via function parameters and annotations.
I don't see immediate practical use, but i think its cool and wanted to share this proof of concept.

godbolt.org
u/Dooez — 1 day ago