Quantcast
Viewing all articles
Browse latest Browse all 4

C++ Do operation on bits of a std::bitset

I want to AND 4 4-bits of a std::bitset<16> with each other. I mean:

std::bitset<16> arr("1100 1100 1100 1100");

I want to AND these 4-bits array.

std::bitset<4> a;

a= 1100 & 1100 & 1100 & 1100

I want to do this in the most efficient way. Not using for loops.

Thanks in Advance.


Viewing all articles
Browse latest Browse all 4

Trending Articles