[container][slist] constant time splice_after
What happens if I call slist::splice_after(this_iter, that_list, that_begin, that_end, nelems) with an nelems value that does not match std::distance(that_begin, that_end). In other words, is there any kind of validations performed on nelems and is it just used to update the size of the list? Aaron
El 13/09/2014 12:06, Aaron Levy escribió:
What happens if I call slist::splice_after(this_iter, that_list, that_begin, that_end, nelems) with an nelems value that does not match std::distance(that_begin, that_end). In other words, is there any kind of validations performed on nelems and is it just used to update the size of the list?
No. In Debug mode, I think the implementation does the check, but any check in runtme would invalidate the aim of the functions, which is O(1) splice. is nelems != std::distance(that_begin, that_end), then it's undefined behaviour. The documentation says this in the "Requires" clause, if the prerequisites are not met, then there is no guarantee. Best Ion
participants (2)
-
Aaron Levy
-
Ion Gaztañaga