Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ok, I stop trying to please sonar.
[simgrid.git] / src / mc / AddressSpace.hpp
index 5c4f515..95a938d 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 {
@@ -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;
   }
 
 };