Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-04-12 14:18:07


At 02:54 PM 4/12/2001, Dejan Jelovic wrote:

>... I've developed a
>template class called arithmetic_type_wrapper. It provides a thin wrapper
>around primitive types like int and double but lets you define different
>types to represent different things.
>
> ...
>
>Is there any interest in adding this to Boost?

Yes, for sure. I think the topic may have come up here before, too. Not
to mention that C.A.R Hoare once proposed that programming languages attach
unit-of-measure to quantities, IIRC.

There is a related problem when for types representing identifying
numbers. For example, CountryID, ProvinceID, PostalCodeID,
CustomerID. They should never be mixed, and should support only a limited
set of arithmetic operations. Incrementing a CustomerID by one is useful,
but adding two CustomerId's is probably a mistake, for example.

I have a Identifier class for the purpose that has been useful, but isn't
ready for prime time. Perhaps you might consider dealing with Identifiers
as a subset of your proposal.

--Beman


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