模板

for (int i = s; i; i = (i - 1) &s)
据说可以视作s忽略0之后不断-1的过程。

原文地址:https://www.cnblogs.com/Yinku/p/10938966.html