I wanted to create containers from other container instances by changing the order of elements in a stridden pattern such as following:[1, 2, 3, 4, 5, 6, 7, 8] with factor of 2 as stride turns into:[1, 3, 2, 4, 5, 7, 6, 8]I try to keep it as generically as possible I can.If I have reinvented the wheel and this can easily done by STL algorithms please warn me. template<typename SeqContainer, typename Integral>SeqContainer strider(const SeqContainer & c, Integral stride){    static_assert(std::is_integral<Integral>::value, 'Integral' template type must be an integral type!);    SeqContainer n;    n.resize(c.size());    if(c.size() % stride != 0)    {        std::cerr << container size must be multiple of stride!\n;        return SeqContainer{};    }    std::vector<decltype(c.begin())> it_vec;    it_vec.reserve(c.size() / stride);    for(auto it = c.begin(), et = c.end(); it != et;)    {        it_vec.emplace_back(it);        std::advance(it, stride);    }    for(auto it = n.begin(), et = n.end(); it != et;)    {        for(auto& iter : it_vec)        {            *it = std::move(*iter++);            ++it;        }    }    return n;}The ideone link : http://ideone.com/9QaPa0
Stride Shuffling of Sequential STL Containers (except std::array)
c++;algorithm;c++11;collections