You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iris::recursive_wrapper should provide std::formatter specialization #37
Currently, iris::rvariant<iris::recursive_wrapper<T>> does provide std::formatter specialization. It is possible solely because iris::recursive_wrapper<T> is handled as a special case by rvariant's specification.
However, the plain iris::recursive_wrapper<T> cannot be formatted. This was initially considered acceptable because the original std::indirect<T> does not provide formatter specialization. I think this inconsistency is somewhat observable in application code and should be addressed.
intmain()
{
iris::rvariant<int, iris::recursive_wrapper<std::string>> var;
std::println("var is {}", var); // ok because `rvariant`'s spec explicitly allows this for convenience
var.visit(iris::overloaded{
[](intconst& val) { std::println("value is {}", val); },
[](autoconst& unhandled_alt) {
std::println("unhandled alternative: {}", unhandled_alt); // compile error *by design*, but... why?std::println("unhandled alternative: {}", var); // ok...... but ugly workaround
},
});
}
Activity
saki7 commentedon Mar 1, 2026
One workaround is to apply
iris::unwrap_recursive(unhandled_alt)but I think it's still cumbersome.