Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cut the backtrace displayed from sthread to the sthread_create to hide useless cruft
[simgrid.git] / examples / cpp / io-disk-raw / s4u-io-disk-raw.cpp
index f5ce9dda579c37f2f809bceb4c02595552c532c5..3c50a7bc79712823f4f9b6b8c631389e1a6d8c40 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -43,14 +43,13 @@ static void host()
   /* - Attach some user data to disk1 */
   XBT_INFO("*** Get/set data for storage element: Disk1 ***");
 
-  const auto* data = disk->get_data<std::string>();
+  auto data = disk->get_unique_data<std::string>();
 
   XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
 
   disk->set_data(new std::string("Some user data"));
-  data = disk->get_data<std::string>();
+  data = disk->get_unique_data<std::string>();
   XBT_INFO("Set and get data: '%s'", data->c_str());
-  delete data;
 }
 
 int main(int argc, char** argv)
@@ -59,10 +58,10 @@ int main(int argc, char** argv)
   e.load_platform(argv[1]);
 
   /* - Display Host properties */
-  for (auto h : e.get_all_hosts()) {
+  for (auto const* h : e.get_all_hosts()) {
     XBT_INFO("*** %s properties ****", h->get_cname());
-    for (auto const& kv : *h->get_properties())
-      XBT_INFO("  %s -> %s", kv.first.c_str(), kv.second.c_str());
+    for (auto const& [key, value] : *h->get_properties())
+      XBT_INFO("  %s -> %s", key.c_str(), value.c_str());
   }
 
   sg4::Actor::create("", e.host_by_name("bob"), host);