![]() |
Boost : |
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-06-01 18:06:18
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
>subtraction.
>
>
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.")
Sebastian Redl
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk