cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Lounge
std::move - Linear or constant?
std::move - Linear or constant?
Feb 14, 2013 at 5:29pm UTC
ResidentBiscuit
(4459)
First off, I have no idea how move actually happens. Anyways, on our site we have std::move as O(n) complexity. But on some other site
(cprogramming? I forget)
they had it listed as O(1) complexity. Big difference, so which is it?
EDIT:
Found the site.
http://en.cppreference.com/w/cpp/utility/move
Last edited on
Feb 14, 2013 at 5:29pm UTC
Feb 14, 2013 at 5:31pm UTC
LB
(13399)
There are two different overoads:
http://en.cppreference.com/w/cpp/algorithm/move
- move several things
http://en.cppreference.com/w/cpp/utility/move
- move one thing
On this site, we only have the algorithm one listed:
http://www.cplusplus.com/reference/algorithm/move/
The utility one is not on this site yet :(
Last edited on
Feb 14, 2013 at 5:33pm UTC
Feb 14, 2013 at 5:33pm UTC
ResidentBiscuit
(4459)
algorithm::move. I didn't catch the difference earlier. I guess that clears up the confusion now, they are both O(n).
/thread
Feb 14, 2013 at 5:34pm UTC
LB
(13399)
<algorithm>'s move is O(n)
<utility>'s move is O(1)
Also, mark as solved.
Last edited on
Feb 14, 2013 at 5:34pm UTC
Feb 14, 2013 at 6:00pm UTC
cire
(8284)
The
utility
one is essentially a no-op. It just returns an rvalue reference to the parameter it is fed.
Last edited on
Feb 14, 2013 at 6:00pm UTC
Topic archived. No new replies allowed.