Yes. That is the problem. My solution can be applied only to arrays, std::array, vectors and strings.
However for list you can probably use splice with custom iterators (which advance twice at the time).
I just don't like to use something which can lead to hard-to-find errors with different compilers.
I would like only to append that there is a solution that can be applied to input iterators of the original sequence when a new sequence must be build..:) Of course the target sequence shall heve a bidirectional iterator.
I would like only to append that there is a solution that can be applied to input iterators of the original sequence when a new sequence must be build.
Start iterating from the beginning. Copy first element to beginnging of target sequence and increment beginning iterator, next to the end and decrement end, next to beginning...
@MiiNiPaa
Start iterating from the beginning. Copy first element to beginnging of target sequence and increment beginning iterator, next to the end and decrement end, next to beginning...
Start iterating from the beginning. Copy first element to beginnging of target sequence and increment beginning iterator, next to the end and decrement end, next to beginning...
Can we do this without using a for loop or one of the previously chosen in-built algorithms? Please do not post the solution yet, I wanna rack my brains a bit.