Boost logo

Boost :

From: Jens Maurer (jmaurer_at_[hidden])
Date: 1999-08-03 17:27:40


Beman Dawes wrote:
> * A template approach where the user would write code like:
>
> int_t<32>::exact // to obtain the 32-bit integer type
> int_t<32>::max() // to obtain the maximum value

We should probably use int_t<> only for getting the correct type
and use numeric_limits<> for getting max/min values.

The last line would read

     numeric_limits<int_t<32>::exact>::max()

instead. If you need this more than once in application code,
you are encouraged to employ a typedef to save typing.

> While the template approach seems conceptually more elegant, I find
> the resulting user code unbearably ugly.

As Dietmar already pointed out, there could be applications
where specifying the width as a template parameter might be
natural.

Do we need the signed/unsigned distinction as a second "bool"
template parameter in the above definitions?

Jens Maurer.


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