Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix for potentially empty names
[simgrid.git] / src / smpi / include / smpi_datatype.hpp
index 294e617381b492ba0c3f3f60df893745a16fbcd1..19ad3abd140a7acc4334e3569ee87e84c4c60c22 100644 (file)
@@ -127,8 +127,7 @@ public:
   Datatype(const Datatype&) = delete;
   Datatype& operator=(const Datatype&) = delete;
   ~Datatype() override;
-
-  const char* name() const { return name_.c_str(); }
+  std::string name() const {return name_.empty() ? std::string("MPI_Datatype") : name_;}
   size_t size() const { return size_; }
   MPI_Aint lb() const { return lb_; }
   MPI_Aint ub() const { return ub_; }