Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-03-13 13:23:36


on 3/12/01 9:15 AM, Beman Dawes at bdawes_at_[hidden] wrote:

> At 03:41 PM 3/11/2001 -0500, Daryle Walker wrote:
>
>> The class templates boost::int_t and boost::uint_t, in <boost/integer.hpp>
>> let an user find the smallest built-in type that has at least the given
>> amount of bits, if possible. I was wondering if we could make similar class
>> templates, but only work if the given number of bits is _exactly_ a count of
>> a built-in type. For example, on most common systems, we would want
>> instances of 8 (unsigned char), 16 (unsigned short), and 32 (unsigned long)
>> bits to work, but would want counts like 24 or 13 bits to fail.
>
> What about C99's and boost/cstdint.hpp int32_t, uint32_t, etc.? Is there a
> reason you need a template rather than just specifying the particular type you
> want?

1. It needs to be a template like boost::uint_t since I want the bit count
to be selectable.
2. Since the bit count isn't fixed, we should support platforms that don't
have the common 8-16-32 built-in types. (The implementation should compare
the desired bit count with std::numeric_limits<Something>::digits.)

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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