Hi,
I'm building a simple engine, and my Node class has a member
queue<unique_ptr<Action>> m_actions
that maintains a queue of actions to be processed by this node. It also has a functions to add another action to perform:
inline void Node::addAction (std::unique_ptr<Action> action) {
action ->setTarget(this);
m_actions. push (std::move(action));
}
As you can see, I'm using move semantics to pass the ownership of the action to the Node. This seems to work fine in Visual Studio, but then I tried to build this in Xcode and I'm getting the following error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:1466:36: No matching constructor for initialization of 'std::__1::unique_ptr<Action, std::__1::default_delete<Action> >'
which seems to imply that for some reason the unique_ptr is getting copied somewhere down the line. Does anyone know what is going on here and the reason of the difference behaviours for the two compilers?
Thanks!
Fabrizio