Questions tagged [move]

Usually refers to move semantics; consider using that tag instead. Move semantics is a programming language feature that allows a copy operation to be replaced by a more efficient "move" when the source object is a temporary or an otherwise expiring object.

Usually refers to ; consider using that tag instead.

Move semantics is a programming language feature that allows a copy operation to be replaced by a more efficient "move" when the source object is a temporary or an otherwise expiring object.

For more information on move semantics in C++, see Rvalue references and move constructors.

Related tags are , , and .

3461 questions
62
votes
3 answers

What makes moving objects faster than copying?

I have heard Scott Meyers say "std::move() doesn't move anything" ... but I haven't understood what it means. So to specify my question consider the following: class Box { /* things... */ }; Box box1 = some_value; Box box2 = box1; // value of…
Laith
  • 1,248
  • 2
  • 11
  • 19
61
votes
1 answer

Changes using mutable reference of a field are not reflected after move of the original instance

I was trying to manipulate the field x of the struct Foo by borrowing a mutable reference from its instance foo. If I try to print the field x using the moved binding y of the instance foo after the move of the original instance, it keeps printing…
Ohjun Kwon
  • 593
  • 4
  • 8
55
votes
4 answers

How do I move a Perforce "workspace" folder?

I've just downloaded a 4.5GB depot to a location on my hard drive that is not ideal. I'd like to move the folder that Perforce now sees as the "workspace" folder (iPhone) to another folder on my hard disk (Project Name), and then use that folder as…
Dave Stewart
  • 2,324
  • 2
  • 22
  • 24
51
votes
2 answers

Is it possible to std::move local stack variables?

Please consider the following code: struct MyStruct { int iInteger; string strString; }; void MyFunc(vector& vecStructs) { MyStruct NewStruct = { 8, "Hello" }; vecStructs.push_back(std::move(NewStruct)); } int main() { …
Allgaeuer
  • 725
  • 1
  • 7
  • 12
45
votes
6 answers

How to move a marker in Google Maps API

I'm using the Google Maps API V3 and I'm trying to make a marker move across the screen. Here's what I have: