-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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
},
});
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request