Is there a one liner (or a simple loop-free) solution to de-interleave the odd and even entries of a vector?
Example:
long entries[] = {0,1,2,3,4,5,6,7};
std::vector<long> vExample(entries, entries + sizeof(entries) / sizeof(long) );
vExample.intertwine(vExample.begin(),vExample.end()); // magic one liner I wish existed...
for (int i = 0; i < vExample.size(); i++)
{
std::cout << vExample[i] << " ";
}
Now I'd like to have the following output:
0 2 4 6 1 3 5 7