Daily bit(e) of C++ | std::visit
Daily bit(e) of C++ ♻️66, Processing the active member of a std::variant using std::visit.
When working with std::variant, processing the current active member can lead to cumbersome code.
An alternative, especially when the processing code is generic, is the std::visit.
The std::visit requires as an argument an invocable that is compatible with each of the contained types. This can be achieved through a combination of concrete and generic operator() overloads.