Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please cppcheck (codacy).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 8 Dec 2017 11:15:46 +0000 (12:15 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 8 Dec 2017 11:15:46 +0000 (12:15 +0100)
include/xbt/functional.hpp

index fcec559..8b73dab 100644 (file)
@@ -184,7 +184,8 @@ public:
     if (that.vtable_ && that.vtable_->move)
       that.vtable_->move(buffer_, that.buffer_);
     else
     if (that.vtable_ && that.vtable_->move)
       that.vtable_->move(buffer_, that.buffer_);
     else
-      std::memcpy(&buffer_, &that.buffer_, sizeof(buffer_));
+      std::memcpy(static_cast<void*>(&buffer_), static_cast<void*>(&that.buffer_), sizeof(buffer_));
+
     vtable_ = that.vtable_;
     that.vtable_ = nullptr;
   }
     vtable_ = that.vtable_;
     that.vtable_ = nullptr;
   }
@@ -194,7 +195,7 @@ public:
     if (that.vtable_ && that.vtable_->move)
       that.vtable_->move(buffer_, that.buffer_);
     else
     if (that.vtable_ && that.vtable_->move)
       that.vtable_->move(buffer_, that.buffer_);
     else
-      std::memcpy(&buffer_, &that.buffer_, sizeof(buffer_));
+      std::memcpy(static_cast<void*>(&buffer_), static_cast<void*>(&that.buffer_), sizeof(buffer_));
     vtable_ = that.vtable_;
     that.vtable_ = nullptr;
     return *this;
     vtable_ = that.vtable_;
     that.vtable_ = nullptr;
     return *this;