Boost logo

Boost :

Subject: [boost] [optional] reduce need for operator ==
From: Jochen Wilhelmy (jochen.wilhelmy_at_[hidden])
Date: 2012-07-19 11:42:07


currently boost::optional<Type> requires an operator == for Type.
If I only want to check if the optional is present or not, then this
is not necessary. e.g.
struct Foo {int i;};
boost::optional<Foo> foo;
if (foo == boost::none)

is it possible to change this? for example by

template<class T>
bool operator == ( optional<T> const& x, none_t )
{ return !x; }


Boost list run by bdawes at, gregod at, cpdaniel at, john at