Joel de Guzman <[EMAIL PROTECTED]> wrote: > IMO, this is better: > > optional<int> x; > if (x == none) > foo(x);
I meant: optional<int> x; if (x != none) foo(x); Of course. And following Brian's example: if (o != none) do_something(o); else maybe_do_other(); > Although I don't see this as problematic: > > optional<int> x; > if (x) > foo(x); > > Or perhaps: > > optional<int> x; > if (!!x) > foo(x); > > We already have an implicit conversion to safe_bool and an > operator ! anyway. Keep it. There's nothing wrong with it: > > operator unspecified-bool-type() const; > bool operator!() const; > > Perhaps it's just me, but I really dislike the * syntax. Why make optional > pretend that it is a pointer when it's clearly not! Then, we go on and give > it value semantics! C'mon! -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost