Boost logo

Boost :

Subject: Re: [boost] boost::compressed_bitset
From: Jeffrey Bosboom (jbosboom_at_[hidden])
Date: 2009-06-11 02:57:56


Scott McMurray wrote:
> 2009/6/10 Jeffrey Bosboom <jbosboom_at_[hidden]>:
>>> I almost exclusively use this structure in a way that interval nodes
>>> represent sequences of 1 bits, but it can just as easily be used the other
>>> way around, where intervals represent sequences of 0 bits. In fact now
>>> that
>>> I think about it probably doesn't even matter.
>> Since it will use less space if the bitset is sparse with occasional 0 or 1
>> bits, this sounds like a good choice for a nontype template parameter.
>> Obviously the user could just invert the sense of the bits themselves
>> (instead of representing presence in a set, it could represent "lack of
>> absence"), but a template parameter would be more user-friendly. A
>> converting constructor could be provided for converting between the two.
>>
>
> I'm not sure it's worth the complexity. It's usually not that hard to
> invert a condition in user code, since renaming the variable from
> visited to pending, free to allocated, or similar makes it just about
> as readable.

You may be right. I was thinking it would help with type-checking if
two modules were passing one to one another but didn't agree on the
sense of the bitset, but that doesn't seem to be a problem with
std::bitset either.

--Jeffrey Bosboom


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