|
Boost : |
From: Dietmar Kuehl (dietmar.kuehl_at_[hidden])
Date: 1999-08-03 16:02:40
Hi,
>* 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
>
>* A typedef and constant approach where the user would write:
>
> int32 // to obtain the 32-bit integer type
> INT32_MAX // to obtain the maximum value
While this is different in C, I think the template approach is the only
viable one in C++! Otherwise, how would I write generic code where the
number of exact bits is specified? Of course, you might argue that there
is no such thing and I would indeed have to think about it for a moment.
However, the template approach creates a weak relation between the types
and the value which might be used by a certain implementation. For the
typedef/constant approach I would have to create it myself.
Just my thoughs,
Dietmar
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk