
That's really an issue of utility: Is the additional utility (which some seem to feel is essentially zero) it provides worth the additional complexity? A general range restriction wrapper, as suggested, might give you more bang for the buck, but support for unsigned integer is not just another range restriction. Non-negative integers -- i.e., numbers representing cardinality how *many* of some kind of thing there is -- is a uniquely useful and meaningful range restriction with special mathematical and practical properties. It isn't "just" a range restriction of integers. In fact, historically, the opposite is the case: the integers were an extension of the counting numbers. Much of the utility of range restriction will come out of range restrictions based on cardinality (e.g., the number of elements in a collection, or the number of ASCII characters), for example, so most use of range restricted integers would conceptually be range restrictions of unsigned integers whether or not those are instantiated as a separate type. In other words, a range restriction of 0..infinity is a "natural", useful and broadly meaningful, while a range restriction of, say -13..87 is arbitrary, and only useful and meaningful within a some restricted context. That isn't to say its worth implementing separately, however. Its just that its the same kind of question as whether its worth having an externally visible implementation of indefinite magnitude integer if you are going to have indefinite precision/magnitude rationals. Topher At 03:46 PM 6/1/2006, you wrote:
Topher Cooper <topher@topherc.net> writes:
I don't think anyone really objects to unsigned_integer, though some question its utility.
I do object. IMO it adds complexity for little or no benefit, and complexity is a big problem. Also, in my opinion, the job of limiting the allowed range of values for a type should be provided by a wrapper template, so that other types can benefit. For example:
typedef range_checked< infinite_precision_integer , non_negative // a predicate
infinite_precision_unsigned_integer;
typedef range_checked< double , abs_less_or_equal_to_1
result_of_sin_or_cos;
-- Dave Abrahams Boost Consulting www.boost-consulting.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost