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.
int main()
{
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{
[](int const& val) { std::println("value is {}", val); },
[](auto const& unhandled_alt) {
std::println("unhandled alternative: {}", unhandled_alt); // compile error *by design*, but... why?
std::println("unhandled alternative: {}", var); // ok...... but ugly workaround
},
});
}
Currently,
iris::rvariant<iris::recursive_wrapper<T>>does providestd::formatterspecialization. It is possible solely becauseiris::recursive_wrapper<T>is handled as a special case byrvariant's specification.However, the plain
iris::recursive_wrapper<T>cannot be formatted. This was initially considered acceptable because the originalstd::indirect<T>does not provide formatter specialization. I think this inconsistency is somewhat observable in application code and should be addressed.