move-semantics

Can a stack have an exception safe method for returning and removing the top element with move semantics?

In an answer to a question about std::stack::pop() I claimed that the reason pop does not return the value is for exception safety reason (what happens if the copy constructor throws). @Konrad commented that now with move semantics this is no longer relevant. Is this true? AFAIK, move constructors can throw, but perhaps with noexcept ...

Can someone please explain move semantics to me?

I just finished listening to the Software Engineering talk radio podcast interview with Scott Meyers regarding C++0x. Most of the new features made sense to me and I am actually excited about C++0x now, with the exception of one. I still don't get "Move Semantics"... What are they exactly? ...

Special member functions in C++0x

The Wikipedia article about special member functions doesn't contain any reference to move constructors and move assignment operators. I would like to update the entry but I'm not sure what the 0x standard says. What are the rules regarding these two functions? Are they automatically generated by the compiler and if so when? Edit: I...

Is it bad form to provide only a move constructor?

I would like to return a noncopyable object of type Foo from a function. This is basically a helper object which the caller will use to perform a set of actions, with a destructor to perform some cleanup after the actions are complete. Before the advent of rvalue references, I would have returned a shared_ptr<Foo> or something similar. ...

How can moved objects be used?

After moving an object, it must be destructable: T obj; func(std::move(obj)); // don't use obj and let it be destroyed as normal But what else can be done with obj? Could you move another object into it? T obj; func(std::move(obj)); obj = std::move(other); Does this depend on the exact type? (E.g. std::vector could make specific ...

Move constructor for a map

I think I do understand "the basic IDEA" of move semantics, but now when I'm on the stage of implementing my own map I stopped and started to think about it when I was going to write a use case and walk through for move ctor of map. Correct me if I'm wrong but what I do understand how the whole business of move semantics works is that th...