I used this structure (although I knew it by totally different name) a lot in time constrained contests, the code is very short and easy to implement.
Also:
idx -= (1 << ctz(idx));
I used to write this as: idx -= idx&-idx;