Por que esse código C ++ 0x não chama o construtor de movimentação?
Por algum motivo, o código a seguir nunca chamaEvent::Event(Event&& e)
<code>Event a; Event b; Event temp; temp = move(a); a = move(b); b = move(temp); </code>
Por que não?
Usandostd::swap
chama uma vez.
<code>class Event { public: Event(): myTime(0.0), myNode(NULL) {} Event(fpreal t, Node* n); Event(Event&& other); Event(Event const& other) = delete; ~Event(); bool operator<(Event const& other) const { return myTime < other.myTime; } bool operator>(Event const& other) const { return myTime > other.myTime; } fpreal getTime() const { return myTime; } void setTime(fpreal time) { myTime = time; } Node* getNode() const { return myNode; } private: fpreal myTime; Node* myNode; }; </code>