Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-06-01 18:49:48

Sebastian Redl <sebastian.redl_at_[hidden]> writes:

> Marsh J. Ray wrote:
>>Seems to me that, if the author is really set on using inheritance here,
>>integer should inherit from unsigned_integer, since integer can do
>>everything that an unsigned can do, but not vice-versa. Integer extends
>>unsigned with the ability to represent negative values and the result of
> No, that's not true. (See Scott Meyers, Effective C++, Item 35) If a
> signed integer IS-A unsigned integer, then all invariants of unsigned
> integer must hold true for signed integer - including the one about
> negative values. ("There's no such thing.")

IMO the whole idea of using inheritance here is so misguided in the
first place that which order you do it in is probably not worth
arguing about.

Dave Abrahams
Boost Consulting

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