Author: James DennettJames Dennett Date: Jan 19, 2007 07:07
Francis Glassborow wrote:
> In article , James Dennett
> acm.org> writes
>> You could just use long, and it would work -- or do you have
>> some specific requirements on range checking or wraparound?
>> If so, using a class and operator overloading would be the
>> way to go.
> It is actually quite hard to produce a class type that behaves like an
> integer type but has some added constraint unless one forgoes implicit
> outward conversions (i.e. do not provide any conversion operators)
If seeking a theoretically perfect solution, that's
true.
In a specific application, it's generally much more
straightforward. (And forgoing implicit outward
conversions is often a good way to go.)
-- James
|