X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/04cb8833befbe07b6b94ff0cae98bc17b78724e3..88fad0aaff9eb463f048bfdfe4ad6218aba44ddb:/include/simgrid/kernel/future.hpp diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 777a9f48b2..f0c8cacb4e 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016. The SimGrid Team. +/* Copyright (c) 2016-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ public: FutureStateBase(FutureStateBase const&) = delete; FutureStateBase& operator=(FutureStateBase const&) = delete; - XBT_PUBLIC(void) schedule(simgrid::xbt::Task&& job); + XBT_PUBLIC void schedule(simgrid::xbt::Task&& job); void set_exception(std::exception_ptr exception) { @@ -181,7 +181,7 @@ public: xbt_assert(this->value_); T* result = value_; value_ = nullptr; - return *value_; + return *result; } private: @@ -207,9 +207,9 @@ public: template void bindPromise(Promise promise, Future future) { - struct PromiseBinder { + class PromiseBinder { public: - PromiseBinder(Promise promise) : promise_(std::move(promise)) {} + explicit PromiseBinder(Promise promise) : promise_(std::move(promise)) {} void operator()(Future future) { simgrid::xbt::setPromise(promise_, future); @@ -282,7 +282,7 @@ template class Future { public: Future() = default; - Future(std::shared_ptr> state) : state_(std::move(state)) {} + explicit Future(std::shared_ptr> state) : state_(std::move(state)) {} // Move type: Future(Future&) = delete; @@ -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)