Skip to main content
gamedev.net
🔒 Locked

moving items in std::lists

Started by Gammastrahler Jul 17, 2003 at 9:17 AM 2 replies 200+ views
Original Post
Gammastrahler
Gammastrahler
hi, i want to move items within a list to some other location. for example consider this list: 0 1 2 [3 4] 5 6 7 8 9 i want to shift the elements [3 4] to get this pattern: 0 1 2 5 6 [3 4] 7 8 9 i have tried to do this with list->splice, but it does not seem to work and requires to many calls.... is there another possibility? thanks Gammastrahler
Wildfire
Wildfire
Have you tried std::swap ?
How do I set my laser printer n stun? o
Gammastrahler
Gammastrahler
yes, but swap requires you to have on element and one iterator...

i need two iterators
Sneftel
Sneftel
try std::swap_ranges.


How appropriate. You fight like a cow.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.