• Advertisement

Archived

This topic is now archived and is closed to further replies.

STL List

This topic is 5840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using an STL list for my scene graph class. I''m at the part now where I''m sorting based on texture or shader so I need to be able to move parts of the list around to rearrange order. For example, I might want to insert nodes 3-5 in front of node 1. Or I might want to insert nodes 7-12 in front of node 5, etc.... My problem is moving this stuff around. I don''t want to use STL sort methods ''cause of some reasons. I want to be able to take a section of the list and insert it into another region of the list. How can I do this with the STL list class? Should I use the splice function?

Share this post


Link to post
Share on other sites
Advertisement
Do I incur a heavy cost for this splicing? Does it perform N allocations and deallocations or is it smart enough to just change the internal links?

Share this post


Link to post
Share on other sites
Yes, it only moves internal pointers.

Trust the STL. It has been designed for speed.

Share this post


Link to post
Share on other sites

  • Advertisement