Replies: 1 comment 3 replies
-
A simple one-liner would be just |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think it would be nice to have a method that allows me to move an item of an array to front or rear of the array. In my use case I have an array with values [1, 2, 3] (or any other variant items) and loop over it round-robin so it changes
[1, 2, 3]
[2, 3, 1]
[3, 1, 2]
[1, 2, 3]
and so on ...
Right now I am using remove() and append() to achieve my goal but it would be nice to reduce it to a one-liner instead. The already existing push_back() and push_front() are actually creating a copy of the value and pushing them to the end of the array instead of moving it thus increasing the size of the array.
Beta Was this translation helpful? Give feedback.
All reactions