StephenCleary / Deque

Double-ended queue
MIT License
121 stars 25 forks source link

Rotate function #4

Open nojaf opened 5 years ago

nojaf commented 5 years ago

Would a rotate function be useful? Similar how python has it.

StephenCleary commented 5 years ago

Do you need it?

nojaf commented 5 years ago

There was one day in the Advent of code that I had a usecase for it. Thought it could help others as well if it is added out of the box. Feel free to disagree and close if you think otherwise.

jzukowski commented 5 years ago

I think I know what you're referring to, the marble game. the DE queue was great to solve that. As for the rotate, as long as you kept your current marble in the front or back, a simple call like d.AddToBack(d.RemoveFromFront()); or vice versa solved the issue. Rotate may be overkill. Great suggestion though.