```
vector<vector<int>> subsets(vector<int>& nums)
{
vector<vector<int>> res;
for (int i = 0, total = pow(2, nums.size()); i < total; ++i) {
vector<int> curr;
for (int j = 0, k = i; k; ++j, k >>= 1) {
if (k & 1) curr.push_back(nums[j]);
}
res.push_back(curr);
}
return res;
}
```