Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make function "const", and void copy by returning a const reference.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 10 Jul 2023 08:56:18 +0000 (10:56 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 10 Jul 2023 09:05:05 +0000 (11:05 +0200)
src/mc/explo/Exploration.cpp
src/mc/transition/Transition.hpp

index f6b4c85..3c8e650 100644 (file)
@@ -87,7 +87,7 @@ std::vector<std::string> Exploration::get_textual_trace()
 {
   std::vector<std::string> trace;
   for (auto const& transition : get_record_trace()) {
-    auto call_location = transition->get_call_location();
+    auto const& call_location = transition->get_call_location();
     if (not call_location.empty())
       trace.push_back(xbt::string_printf("Actor %ld in %s ==> simcall: %s", transition->aid_, call_location.c_str(),
                                          transition->to_string().c_str()));
index 6beb8af..281675f 100644 (file)
@@ -67,7 +67,7 @@ public:
   /** Returns something like >>label = "desc", color = c<< to describe the transition in dot format */
   virtual std::string dot_string() const;
 
-  std::string get_call_location() { return call_location_; }
+  std::string const& get_call_location() const { return call_location_; }
 
   /* Moves the application toward a path that was already explored, but don't change the current transition */
   void replay(RemoteApp& app) const;