Jerry Coffin wrote:
> says...
>
>> The title is not exactly a disnomer, so pleaes let me explain...
>>
>> Say I have a large number of 0-1 vectors containing only bits
>> corresponding to 0 or 1. Now given an arbitrary 0-1 vector,
>> I wish to find all the 0-1 vectors that are subsumed by that
>> query bit vector.
>>
>> For example, given bit vector query as 01100, i wish to find
>> all bit vectors that whose 1st, 4th, 5th bits are also zero,
>> leaving the 2nd, 3rd bits as either 0 or 1.
>
> Assuming your bit-vectors were stored in an integer type, you
> could use a comparison like this:
>
> if ((bit_vector | pattern) == pattern)
> // found
> else
> // not found
>
> If you need to store larger bit-vectors than will fit in any
> integer type (only 32 are guaranteed), you can look at
> std::bit_vector and/or std::vector<bool>. IIRC, bit_vector
> supports boolean operations directly, but for vector<bool>
> you'll probably need to write your own.
The fault is basically that of the OP, but please do not post
off-topic information on c.l.c. It is easy to overlook the foolish
cross-posting, but you should not answer in any group where the
answer (and question) are off topic. F'ups set.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews