I’m trying to create a class that acts similar to std::expected (but not a sum type), and I’m trying to mimic some of the API. Many of the member functions, from and_then
, to even value()
have overloads listed for each of the possible reference types (&, const &, && and const &&). I’m not quite sure why this is necessary, Why wouldn’t regular const/non const overloads work, instead of having 4 different ones? Sometimes the standard lists things like this, only to actually require a single or two overloads. But MSVC’s stdlib actually has different overloads for each.