bitset to dynamic bitset
Posted
by mr.bio
on Stack Overflow
See other posts from Stack Overflow
or by mr.bio
Published on 2010-04-26T01:55:51Z
Indexed on
2010/04/26
2:03 UTC
Read the original article
Hit count: 392
Hi.. I have a function where i use bitset.Now i need to convert it to a dynamic bitset.. but i don't know how. Can somebody help me ?
set<string> generateCandidates(set<string> ck,unsigned int k){
set<string> nk ;
for (set<string>::const_iterator p = ck.begin( );p != ck.end( ); ++p){
for (set<string>::const_iterator q = ck.begin( );q != ck.end( ); ++q){
bitset<4> bs1(*p);
bitset<4> bs2(*q);
bs1|= bs2 ;
if(bs1.count() == k){
nk.insert(bs1.to_string<char,char_traits<char>,allocator<char> >());
}
}
}
return nk;
}
© Stack Overflow or respective owner