what is the best way to concatenate 2 bitsets?
For example i've got
boost::dynamic_bitset<> test1( std::string("1111") );
boost::dynamic_bitset<> test2( std::string("00") );
they should be concatenated into a thrid Bitset test3 which then holds
111100
Solutions should use boost::dynamic_bitset. If the solution works with std::bitset, it would be nice too. There should be a focus on performance when concatenating the bits.
UPDATE:
I've compared both methods (stringmethod from me and Neil and shiftmethod from messenger) and the stringmethod was a lot faster (factor 10++). Code here:
http://pastebin.com/HfpfYfy8
I hope Pastebin is ok for posting long code-listings. If there is a better way please contact me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…