|
Boost : |
From: Ronald Garcia (garcia_at_[hidden])
Date: 2002-06-17 17:50:15
I vote "yes" to accept dynamic bitset into boost:
To me, it seems that dynamic bitset is meant more to represent sets than
bits. Based on this assumption, I would like to see in the interface a
means for easily querying which elements are in the set, possibly using
indices. Here's somewhat of a sketch of what I'm thinking of:
boost::array<std::string,3> domain = {{ "red","blue","yellow" }};
boost::dynamic_bitset<> bs(3);
// stuff happens here...
boost::dynamic_bitset<>::size_type i = bs.find_set_index(0);
while (i != boost::dynamic_bitset<>::npos ) {
std::cout << domain[i] << ',';
i = bs.find_set_index(i+1);
}
- I'm not convinced that dynamic bitset should have iterators. I don't
see it as a container but rather another means of representing sets.
Should one class (template) implement the roles of bit vectors and sets
of bits? IMHO, no.
- The review process appears to have revealed some confusion regarding
the dynamic bitset's intent. I think that a section discussing in
greater detail its relation to vector<bool> and bitset might limit
further confusion on the part of library users.
- I would like to see the addition of an "all()" member function. I am
aware that this can already be semantically achieved using the current
interface, but I like to spell all "a-l-l" and I believe the addition
would not overgrow the interface.
Previously discussed items I agree with:
- I prefer the name "dynamic_bitset" to "dyn_bitset".
- The logic tables in the documentation can go.
Little nit-pick-isms:
- The example files (example?.cpp) should include <cstdlib> in order to
get EXIT_SUCCESS.
- In the examples, prefer '\n' to std::endl to prevent excessive buffer
flushing.
- Is CHAR_BIT part of the dynamic bitset interface or need one include
<climits>?
- example1.cpp and example3.cpp have out-of-sync sample output comments.
In addition, the third example in the documentation seems to show
output that is out of sync with the sample code.
- In the documentation of operator>>(basic_istream<...>&,
dyn_bitset<...>&) (edits in sed notation):
s/extracted x.size() character/extracted x.size() characters/
s/other than 1/other than 0 or 1/
ron
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk