Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] Do not use containers of references
[simgrid.git] / examples / s4u / io / s4u_io_test.cpp
index 846ac4c..4f2e993 100644 (file)
@@ -16,13 +16,13 @@ public:
        myHost(const char*procname, simgrid::s4u::Host *host,int argc, char **argv)
 : simgrid::s4u::Actor(procname,host,argc,argv){}
 
-       void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts) {
+       void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage*> &mounts) {
                XBT_INFO("Storage info on %s:",
                        simgrid::s4u::Host::current()->name().c_str());
 
                for (const auto&kv : mounts) {
                        const char* mountpoint = kv.first.c_str();
-                       simgrid::s4u::Storage &storage = kv.second;
+                       simgrid::s4u::Storage &storage = *kv.second;
 
                        // Retrieve disk's information
                        sg_size_t free_size = storage.size_free();
@@ -35,7 +35,7 @@ public:
        }
 
        int main(int argc, char **argv) {
-               boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts =
+               boost::unordered_map <std::string, simgrid::s4u::Storage *>& mounts =
                        simgrid::s4u::Host::current()->mountedStorages();
 
                show_info(mounts);