Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-05-28 09:22:43


David Abrahams wrote:

>Sebastian Redl <sebastian.redl_at_[hidden]> writes:
>
>
>
>>The main (only, really, when it comes down to it) difference
>>between a signed and an unsigned integer is that an unsigned integer is
>>defined never to have a value less than 0. There are very valid reasons
>>to enforce such a restriction,
>>
>>
>
>For example?
>
>
Various physical quantities only make sense for non-negative values. It
would be conceivable to use a boundless unsigned integer as the value
type in the PQS library. Things like length - something cannot have
negative length, and having that restriction enforced by the type itself
would be convenient.
I have no doubt that there are other applications too. size_t is
unsigned - of course, a boundless int should not be necessary for
specifying array indices, but similar applications might exist.

Sebastian Redl


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk