Boost logo

Boost :

From: Chuck Allison (cda_at_[hidden])
Date: 2002-06-13 10:52:20


It was toggle in the original bitset/bitstrings (aka dyn_bitset) proposals
in 1991, but people from outside the U.S. (Germany, mostly) objected and
asked for flip, so we changed it. That's the whole story.

Also, the original proposals were before templates, and we decided that
unsigned long was the portable way to lay out the bits in integral types
(since there is the 32-bit minumum guarantee). I agree that it should be a
tempalte parameter, and I'm not picky about the name of the function that
extracts it.

----- Original Message -----
From: "Fernando Cacciola" <fcacciola_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, June 13, 2002 9:11 AM
Subject: Re: [boost] Dynamic Bitset Formal Review June 8-17

> First, I think this library should be accepted into boost.
>
> I don't mind that it diverges from vector<bool>. I've never liked it
anyway
> :-)
>
> I thing there are two possible kind of 'collection' of bits.
>
> One kind is a container of bits: that is, a sequence of bits that you
> manipulate like you would with a container of anything else. You would,
for
> instance, insert, remove or incrementally add elements (bits) in the
> sequence. This is what I think vector<bool> is for.
>
> Another kind is a "bit-set". It is a collection but not a container in the
> usual sense. A bit-set is typically of fixed size, set either at compile
> time or upon construction. You wouldn't insert or remove bits from a
> bit-set, and only occasionally you would append bits at the end. You might
> want to iterate through the bits to use 'some' algorithms, but I don't
> consider this really critical for the typical uses of bit-sets.
>
> So, I think dyn_bitset<> is properly modeled and it isn't competing with
> vector<bool> (though that wouldn't be a real problem).
>
> If somewhat fast iterators can be added, then add them.. but I wouldn't
mind
> if they are not supported at all.
>
>
> I have two comments on dyn_bitset<> (so far):
>
>
> 1) Why is 'flip' not named 'toggle'?
> (In the implementation, you can see that it was formerly called toggle:-)
>
> 2) What's the rationale for to_long()? How does it work if block_type
isn't
> 'unsigned long', and how does it work if the set contains N blocks (N>1)?
> I understand that I might want to get an integral representation of all
the
> bits in the set, but to_long() might fall short of that task.
> I'll prefer something like:
>
> template<class Integral> Integral to_integral() const ;
>
> which returns a value of type Integral which as much bits from the set as
> possible.
>
> Fernando Cacciola
> Sierra s.r.l.
> fcacciola_at_[hidden]
> www.gosierra.com
>
>
>
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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