From 1f41e2c6457817a041bd7aa8996d98370f22566d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 14 Oct 2017 23:23:09 +0200 Subject: [PATCH] Add a method to get the string_data from a simgrid::xbt::string. --- include/xbt/string.hpp | 2 +- src/mc/mc_smx.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 14c9696c5c..c0126b4da6 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -57,7 +57,6 @@ struct string_data { XBT_PUBLIC_CLASS string : private string_data { static const char NUL; public: - // Types typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; @@ -165,6 +164,7 @@ public: return data()[i]; } // Conversion + static string_data& to_string_data(string& s) { return s; } operator std::string() const { return std::string(this->c_str(), this->size()); } // Iterators diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index 72b087c652..9f075683dc 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -184,7 +184,7 @@ const char* MC_smx_actor_get_name(smx_actor_t actor) simgrid::mc::ActorInformation* info = actor_info_cast(actor); if (info->name.empty()) { - simgrid::xbt::string_data string_data = (simgrid::xbt::string_data&)actor->name; + simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name); info->name = process->read_string(remote(string_data.data), string_data.len); } return info->name.c_str(); -- 2.20.1