[Bug libstdc++/41351] std::rotate on RAI does not conform to ISO complexity requirement

potswa at mac dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 14 18:00:00 GMT 2009



------- Comment #6 from potswa at mac dot com  2009-09-14 18:00 -------
If the alternative stable_partition is faster, maybe it should be used anyway.
For large blocks, virtual memory allocation time may dominate computation, so
it should certainly be faster sometimes.

Back to rotate, I was just answering another question on stackoverflow.com when
I noticed that rotate on a two-dimensional vector would be slow and memory
hungry. I don't actually use it.

I haven't checked out the rvalue reference stuff yet, and from what I see I
don't understand how stl_algo.h would be improved by it without specifying "&&"
anywhere, but I'll take your word for it. Is there another header I missed?

I do still believe that it would be best to let the complexity of a swap be
exactly the runtime of std::swap<value_type>, though. Given that there are
several ways to optimize this code, the standard appears to be recommending a
std::swap specialization as the preferred "helper function," and there does not
appear to be a defect in it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41351



More information about the Gcc-bugs mailing list