While playing around with boost::optionals I had code like the following
struct A {
...
int i;
...
};
boost::optional a;
// do something with 'a'
// optional-projection to a::i
boost::optional<int> a_i;
if(a)
a_i = a->i;
which seemed quite verbose for something that's rather natural in functional
languages: boost::optional is a monadic structure, which lifts a type T by
extending it with a new bottom-element (represented by the empty
optional<T>), thus it should also have a "bind" and a "map"-equivalent,
which could be implemented for instance as as member functions of optional
template<class B>
auto bind(B&& binder) const
-> boost::optional