dynamic_bitset: request for new functions
Hi everybody, is it planned to extend the dynamic_bitset in the near future? I would consider the implementations of the following functions to be particularly useful: find_last(); // position of most significant bit find_previous(size_t pos); // like find next, but in the other direction find_first_not(); // position of first unset bit find_next_not(); //... find_last_not(); //... find_previous_not(); //... further, views would be nice, so that one could act with bitwise operation only on a certain subset of the bitset. and last but not least -- I know that might be beyond the scope of this class -- arithmetics would be nice, so that one could directly copy e.g. the algorithms form bit-twiddling hacks. ( *of course* they should also work on views ^^ ) I know thats a lot, but it would certainly be helpful. Thanks in advance and best regards, David ___________________________________________________________ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
Le 10/11/11 22:28, David Hochstuhl a écrit :
Hi everybody,
is it planned to extend the dynamic_bitset in the near future? I would consider the implementations of the following functions to be particularly useful:
find_last(); // position of most significant bit find_previous(size_t pos); // like find next, but in the other direction
find_first_not(); // position of first unset bit find_next_not(); //... find_last_not(); //... find_previous_not(); //...
further, views would be nice, so that one could act with bitwise operation only on a certain subset of the bitset.
and last but not least -- I know that might be beyond the scope of this class -- arithmetics would be nice, so that one could directly copy e.g. the algorithms form bit-twiddling hacks. ( *of course* they should also work on views ^^ )
I know thats a lot, but it would certainly be helpful.
Hi, yes this is a lot, all the ideas are interesting, even if I don't share with the form. For the find features, I would consider to provide a view of a bitset that behaves as standard set, with iterators. Even if the complexity of these operations could not conform to the standard one, the advantages are evident. In the same way you can associate a view of the complementary set. The view concept you are suggesting could bea generalization of the previous one. The single issue I see, is the alignment of the view, which should conform at least to the byte boundary, if you want to be able to provide data() access. For the bit-twiddling hacks algorithm, the interface is almost ready. Currently there is the data() function given access to the storage, and a constructor from it. The problem is that the access is read-only and the constructor will make a copy. Adding some move functions to extract the storage and to take an external storage would permit to build every algorithm you want on top of them in an efficient way. As you said this is a lot and even if this is not complex, this will need a considerable time to make something with the expected quality. Do you think that you could contribute in some way? I'm sure this could be a good subject for a GSoC project. Just my 2 cts, Vicente
participants (2)
-
David Hochstuhl
-
Vicente J. Botet Escriba