At first I thought that it was quite difficult to look for the sets of elements of any size (sets of 1 element, 2 elements and so on), but then I realised that any selection of the vector elements correspond to a binary code ('1' for selecting that element and '0' for not selecting it). To select all possible elements combinations I only need to use the binary code from 1 to 2^(1+length(v))-1.
At first I thought that it was quite difficult to look for the sets of elements of any size (sets of 1 element, 2 elements and so on), but then I realised that any selection of the vector elements correspond to a binary code ('1' for selecting that element and '0' for not selecting it). To select all possible elements combinations I only need to use the binary code from 1 to 2^(1+length(v))-1.