[gnome-system-monitor] Instead of using an Iterator adaptor as in f8761542 to avoid the use of the deleted copy-constructor



commit be9c236640f6c607c6082fe718ec51c24b26a4b5
Author: Benoît Dejean <bdejean gmail com>
Date:   Mon Jun 26 13:35:44 2017 +0200

    Instead of using an Iterator adaptor as in f8761542 to avoid the use of the
    deleted copy-constructor of ProcInfo by g++ 5.4, use piecewise_construct
    version of std::emplace.
    
    I still don't understand if the normal emplace is valid or not, although it
    is accepted by g++ >= 6 and clang++ >= 3.4.

 src/application.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/application.h b/src/application.h
index 3190298..f1463b9 100644
--- a/src/application.h
+++ b/src/application.h
@@ -164,7 +164,7 @@ public:
         std::lock_guard<std::mutex> lg(data_lock);
         return data.erase(it);
     }
-    ProcInfo* add(pid_t pid) { return &data.emplace(pid, pid).first->second; }
+    ProcInfo* add(pid_t pid) { return &data.emplace(std::piecewise_construct, std::forward_as_tuple(pid), 
std::forward_as_tuple(pid)).first->second; }
     void clear() { return data.clear(); }
 
     ProcInfo* find(pid_t pid);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]