
7 Dec
2010
7 Dec
'10
9:11 a.m.
Dear All, I was a little bit tired of using string initialization of std::bitset like: bitset<8> flag_pattern(string("00111000")); What I found more readable was this: Bitset<8> flag_pattern; //initialisation to "00000000" flag_pattern += 1,3,4,5; //set bits at indices 1,3,4,5 to true: 01011100 flag_pattern -= 1,3; //set bits at indices 1,3 to false: 00001100 In that way I can specify an easy readable configuration of flags: enum { left, right, center } flag_pattern += left,right; If interest exists I could contribute the respective code for the assign library. Best regards, Bernd P.S. Please let me know if I missed some formal criteria for this post as I am new to this NG