Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-09 11:58:40

"E. Gladyshev" <egladysh_at_[hidden]> writes:

So we need a flag in each of
> the event types:
> struct mouse_event
> {
> bool valid_data;
> int x, y;
> mouse_event() { valid_data = false; }
> };
> Why are basic guarantess are better
> than singular variant?

I keep telling you that these are not opposing choices, so I object
to the question. But I'll answer anyway:

Because well-defined classes don't need a "valid_data" flag: their
invariants guarantee that they are always valid, just like all of the
types in the std library and in Boost for that matter. There's no
reason to propagate the crimes of mouse_event up into variant.

Dave Abrahams
Boost Consulting

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