In the original famous Pythagorian Triples blog, there is a maybe_view in the example.
There was also a proposal to the standard to have maybe_view but there isn't any update on that paper
http://open-std.org/JTC1/SC22/WG21/docs/papers/2020/p1255r6.html
However, I don't agree with paper about the nullable concept.
First, why don't we call the concept maybe given that the view is called maybe_view.
Second, I don't think it is a good idea to couple operator bool and operator * with the concept. In the paper itself, there was already a special case reference_wrapper. In real world use case, I believe there will be lots of types, which can represent a null value without operator *. For example, std::function, std::future, std::variant<std::monostate, Foo, Bar>
I think it might be a good idea to create some Customisation Points, which can default to operator bool and operator *. Originally the paper had two customisation points maybe_has_value and maybe_value but they got removed from R0 version, which I can't find the reason for
I propose to have two customisation points and support types that can represent null but don't have operator bool or operator *:
is_just and get_just
In this pull request, except the concept, the implementation is pretty much the same as what it was proposed in that paper.
Feedback welcome!