Hello group!
To my surprize I I noticed yesterday that every
forward_list<>::splice_after overload is said to have a linear time
complexity in the number of spliced elements. Given the tight space
requirements -- somebody thought it would be cool to make
sizeof(forward_list<>)==sizeof(void*) -- I see how one cannot do
splicing in O(1) if only the list with to-be-spliced elements are
known since a pointer to the last element is lacking.
But I would have expected to be able to splice multiple elements in
constant time using the overload
something splice_after(iterator position, forward_list<T> && from,
const_iterator first, const_iterator last);
There is actually a mismatch between the resolution contained in the
LWG issue list and the current draft. The current draft says
O(distance(first,last)) time complexity and the resolution in the
issues list says O(1).
Another problem is that first and last are both exclusive while making
last INCLUSIVE would allow O(1) splicing, from what I can tell. With a
range (first,last] we still get to specify empty ranges.
Any comments and optinions?
Cheers!
SG
--
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]