From 4e4a69258bc6825a548dabc242d5caeaf82ac634 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 7 Dec 2017 09:21:14 +0100 Subject: [PATCH] Add explicit keyword to one-parameter constructors. Easy part: no additional change needed. --- include/simgrid/kernel/future.hpp | 4 ++-- include/simgrid/s4u/Host.hpp | 2 +- include/simgrid/simix/blocking_simcall.hpp | 2 +- include/xbt/functional.hpp | 2 +- include/xbt/string.hpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index a4db6ece20..3a3f29c2c2 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -455,7 +455,7 @@ template class Promise { public: Promise() : state_(std::make_shared>()) {} - Promise(std::shared_ptr> state) : state_(std::move(state)) {} + explicit Promise(std::shared_ptr> state) : state_(std::move(state)) {} // Move type Promise(Promise const&) = delete; @@ -510,7 +510,7 @@ template<> class Promise { public: Promise() : state_(std::make_shared>()) {} - Promise(std::shared_ptr> state) : state_(std::move(state)) {} + explicit Promise(std::shared_ptr> state) : state_(std::move(state)) {} ~Promise() { if (state_ && state_->get_status() == FutureStatus::not_ready) diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 9f9ef0cf17..6743001dbc 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -114,7 +114,7 @@ public: void execute(double flops); private: - simgrid::xbt::string name_ = "noname"; + simgrid::xbt::string name_{"noname"}; std::unordered_map* mounts = nullptr; // caching public: diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index 682b2eeb73..a856eca0ee 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -82,7 +82,7 @@ template class Future { public: Future() { /* Nothing to do*/} - Future(simgrid::kernel::Future future) : future_(std::move(future)) {} + explicit Future(simgrid::kernel::Future future) : future_(std::move(future)) {} bool valid() const { return future_.valid(); } T get() diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 64c3caac9d..dde3b7e60b 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -171,7 +171,7 @@ private: public: Task() { /* Nothing to do */} - Task(std::nullptr_t) { /* Nothing to do */} + explicit Task(std::nullptr_t) { /* Nothing to do */} ~Task() { this->clear(); diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 1916178d89..0cc1c4899a 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -89,7 +89,7 @@ public: } } string() : string(&NUL, 0) {} - string(const char* s) : string(s, strlen(s)) {} + explicit string(const char* s) : string(s, strlen(s)) {} string(string const& s) : string(s.c_str(), s.size()) {} string(string&& s) { -- 2.20.1