Boost logo

Boost :

From: Andy Glew (glew_at_[hidden])
Date: 1999-08-03 18:14:54


> > * A template approach where the user would write code like:
> > int_t<32>::exact // to obtain the 32-bit integer type

I think the template approach is "better",
and "more in the spirit of C++".

My only concern is in template depth.

ANSI C++ requires implementations nest templates only 17
deep.

> The last line would read
> numeric_limits<int_t<32>::exact>::max()

Q: how many of our 17 levels of template nesting does this consume?

(Apart from any levels of template nesting used in the definitions.)

> 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?

{Would be a good argument for keyword parameters.}

While you are at it, why not define

* explicit integer ranges, not just binary bit counts
    int<upper_limit,lower_limit>
    -- you could have unchecked and checked varieties...

* floating point types
       float<mantissa_width,exponent_width>
    -- the folks who have to deal with funny non-IEEE DSP
    floating point formats, such as 24 bit floats, would love
    to see this!


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