|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-06-12 19:11:19
On Wednesday, June 12, 2002, at 07:16 PM, Chuck Allison wrote:
>> I'm guessing that C++0X will entertain the idea of deprecating
>> vector<bool>. I'm also guessing that said movement will be more likely
>> to be successful if there is also a proposed bitvector for vector<bool>
>> clients to migrate to. dyn_bitset does not have to be that class
>> though.
>
> I think this is a good argument in favor of dyn_bitset, and for
> providing
> iterators. I haven't looked at it closely, but can we provide an
> iterator
> for dyn_bitset that meets all the requirements for STL iterators?
No. But you can do no worse than vector<bool>::iterator. And I am
optimistic (maybe hopelessly so) that C++0X will be more gracious
towards proxy iterators and references. Currently in the Metrowerks
implementation, you can use vector<bool>::iterator in all of the
<algorithm>'s. You can even:
std::vector<bool> v(2);
std::swap(v[0], v[1]);
(even though temporaries won't bind to non-const references) This
currently works by overloading T and T& which is a fuzzy area in the
standard (core dr 214). Even though it looks like the resolution of 214
will make this overloading illegal, I am hopeful that another language
feature needed for move semantics will continue to allow the swap
expression to work for proxy references.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk