Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy: use long form of negation in C++
[simgrid.git] / src / mc / AddressSpace.hpp
index 5c4f515..050650c 100644 (file)
@@ -17,7 +17,7 @@
 #include <vector>
 
 #include "src/mc/mc_forward.hpp"
-#include "src/mc/RemotePtr.hpp"
+#include "src/mc/remote/RemotePtr.hpp"
 
 namespace simgrid {
 namespace mc {
@@ -112,7 +112,7 @@ private:
   Process* process_;
 public:
   AddressSpace(Process* process) : process_(process) {}
-  virtual ~AddressSpace();
+  virtual ~AddressSpace() = default;
 
   /** The process of this addres space
    *
@@ -160,11 +160,10 @@ public:
   /** Read a string of known size */
   std::string read_string(RemotePtr<char> address, std::size_t len) const
   {
-    // TODO, use std::vector with .data() in C++17 to avoid useless copies
-    std::vector<char> buffer(len);
-    buffer[len] = '\0';
-    this->read_bytes(buffer.data(), len, address);
-    return std::string(buffer.data(), buffer.size());
+    std::string res;
+    res.resize(len);
+    this->read_bytes(&res[0], len, address);
+    return res;
   }
 
 };