Topic: bitset: pattern search


Author: "Chris Minnoy" <cminnoy@starlab.net>
Date: 1999/01/27
Raw View
>Consider making a bitset iterator class (it would hold a pointer to the
>bitset and a position).  Then you should be able to use std::search().

Would that make it efficient, the need for speed is huge. I'll consider your
proposal. Although I still think adding a find function to the bitset class
will
be the fasted implementation possiple.

>Alternatively you could use vector<bool> which already has iterators, and
>may be implemented as a variable length bitset.


No, that's not memory efficient, taking at least a whole byte just to
represent
a bit, nope, than you can as easily use the string class, which uses also
one byte per bit.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Andrei Alexandrescu" <alexandrescua@micromodeling.com>
Date: 1999/01/27
Raw View
Chris Minnoy wrote in message <917427143.319228@saturn.riv.be>...
[sinp]
>>Alternatively you could use vector<bool> which already has iterators, and
>>may be implemented as a variable length bitset.
>
>No, that's not memory efficient, taking at least a whole byte just to
>represent a bit, nope, than you can as easily use the string class,
>which uses also one byte per bit.

I join the lengthy list of guys who'll point you that vector<bool> uses
one bit per element.

Andrei
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Bill Wade" <bill.wade@stoner.com>
Date: 1999/01/27
Raw View
Chris Minnoy wrote in message <917266073.859036@saturn.riv.be>...
>Shoudn't it be nice to have a find facility for the bitset class.

Consider making a bitset iterator class (it would hold a pointer to the
bitset and a position).  Then you should be able to use std::search().

Alternatively you could use vector<bool> which already has iterators, and
may be implemented as a variable length bitset.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Chris Minnoy" <cminnoy@starlab.net>
Date: 1999/01/25
Raw View
Shoudn't it be nice to have a find facility for the bitset class.
For the moment I use a rather inefficient workaround for that.
First I place the pattern to search in a string object. Than I
convert my bitfield object to a string and call the find memberfunction,
using my earlier search pattern.
Ok, this works, but it isn't efficient.
It could be much more efficient if find was also implemented in the
bitset class.

Chris Minnoy
cminnoy@starlab.net
http://www.starlab.org
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]