Boost logo

Boost :

Subject: Re: [boost] Boost.Integer makeover
From: John Bytheway (jbytheway+boost_at_[hidden])
Date: 2009-11-29 12:38:40

John Maddock wrote:
>> Example
>> What in the world is "is_it_what" supposed to convey? The name is
>> nonsensical to me.
> Me too, I've removed the example. Frankly I'm not sure if anyone is
> actually using the integer-masks, compile-time log2 or min/max
> functions, I don't really see the point, and the examples given don't
> help much :-(

I've used the compile-time log2 to determine the smallest integer type
in which I can store any value of an enumeration. It's not easy to use,
though; I'd prefer something that returned ceil(log2(n)) rather than
floor(log2(n)). I can't make any sense of the existing example.

I've used the bit masks too, though I can't remember what for right now.
 The point of low_bit_mask_t is to avoid code like this, which doesn't
work when n==32 and sizeof(int)==4:

uint32_t mask = (1<<n)-1;

(As the docs say: "When Bits is the exact size of a built-in unsigned
type, the implementation has to change to prevent undefined behaviour.").

The high_bit_mask_t is less useful. I don't see a good use for it. I
don't think I've ever used min/max, either.

John Bytheway

Boost list run by bdawes at, gregod at, cpdaniel at, john at