|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-09 20:21:18
Actually, it's the fast "set" operations that are more important to me...
so I may start with the SGI STL version of std::bitvec and just make it
dynamic sized, and then snatch the iterators from std::vector<bool>...
actually I'm not sure I even really want to iterate over bool's. What I
really want is to convert the bit set into the equivalent compressed
format: a vector of integers, where the integers correspond to positions
in the bit set that are "1". I wonder what the fastest way to do this
conversion is?
Cheers,
Jeremy
On Fri, 9 Mar 2001 scleary_at_[hidden] wrote:
sclear> > So in std we have the static-length bitset which provides "set" operations
sclear> > on bits, and we have a dynamic-length vector<bool> which provides
sclear> > "container" operations on bits. But what about a dynamic-length class that
sclear> > provides efficient "set" operations, or a static-length class that
sclear> > provides "container" operations?
sclear>
sclear> Here's how I would approach this: start with vector<bool> and add another
sclear> iterator -- over int values. Then adding the efficient set operations is
sclear> easy, and it leaves you open to other extensions.
sclear>
sclear> Another approach is to write an iterator adapter that iterates over the bits
sclear> of the contained iterator's value. I started something like this a while
sclear> ago, but it was never finished. Also, the container operations are really
sclear> tricky; my class only provided read access.
sclear>
sclear> > Anyone else ever felt the need for these capabilities?
sclear>
sclear> Actually (I'm ashamed to admit this...) the only time I needed fast set
sclear> operations with dynamic-length, I just used a vector of ints and pretended
sclear> they were bool's. Wasteful in space, but it worked for that particular
sclear> program.
sclear>
sclear> -Steve
sclear>
sclear> List-Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
sclear>
sclear>
sclear> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
sclear>
sclear>
sclear>
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk