'bit manipulation to specific subset

Considering the following code snippet.

    for (int state = 1; state < 1 << n; state ++ )
        if (state & 1)
            for (int t = state; t; t &= t - 1)  

The first for-loop is to enumerate all subsets of n elements, but what subset does the t represent.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source