reflect
reflect copied to clipboard
Extend usage possibilities for the Maybe type.
I found myself unable to write:
Maybe<int> answer()
{
return Maybe<int>(42);
}
int main()
{
maybe_if(answer(), [](int a) {
std::cout << "Answer: " << a << '\n';
});
}
This would yield an error with gcc 5.3.0 because answer() is an rvalue. It would be convenient to write it that way though. So I overloaded maybe_if and MaybeIfImpl with const-qualified versions and the code above now compiles.