Chris Redford
Chris Redford

Reputation: 17788

O(1) std or boost list concatenate

Is there a data structure, such as std::list, that allows O(1) concatenation of one list to the end of another? I.e. the final item in list A is linked to the first item of list B?

Upvotes: 4

Views: 981

Answers (1)

Kyle Lutz
Kyle Lutz

Reputation: 8036

Yes, std::list::splice() allows you to concatenate two std::list's in constant time.

Upvotes: 10

Related Questions