I am trying to understand one C++ program, which has a loop written as follows:
for(int i = 0; i < (1<<m); ++i) {
for(int k = 0; k < m; ++k) {
if(i&(1<<k)) {
//in subset
}
}
}
I do not understand how the loop control condition
i < (1<<m);
works?
Besides, I do not understand how the if condition
if(i&(1<<k))
works?