Template talk:cpp/container/splice

In case the container is a std::list, the complexity mentioned on this template was incorrect. Splice takes constant time in case source and target are the same and linear otherwise. The reason is, that size has to be recalculated (size takes O(1) which is not possible otherwise) in case source and target differ but not when they are the same. This was confirmed with the latest publicly available working draft.

Could somebody who has the final version available confirm that this has not been changed since WG3242? If it has been changed somehow, please add a point in the discussion, to avoid further editing.

--Till 01:39, 15 February 2012 (PST)


 * In the meantime, I'll fix to the correct version. Even if C++11 does indeed specify splice as O(1), that's a contradiction, and a DR should be opened for it. By the way, I have the last revision of the working draft (N3291) which was accidentally published for a few days. It contains the same description of splice as N3242. -P12 05:28, 15 February 2012 (PST)


 * Why do you think this is a contradiction? Splice for this == &other can be provided in O(1) since O(n) is only necessary for updating size. However size stays constant if this == &other, so O(1) is not giving trouble at all. -Till 03:28, 21 February 2012 (PST)


 * I was talking about general case ( in which size needs updated. Anyways, now I realized that it's possible to have O(1) even if, since is O(1). So the previous complexity description was correct. BTW, the spec is already floating in the internet, it specifies O(1). P12 04:19, 21 February 2012 (PST)