Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics to please codacy
[simgrid.git] / include / simgrid / kernel / future.hpp
index 034963d..581db40 100644 (file)
@@ -61,7 +61,7 @@ public:
 
   void set_continuation(simgrid::xbt::Task<void()>&& continuation)
   {
-    xbt_assert(!continuation_);
+    xbt_assert(not continuation_);
     switch (status_) {
     case FutureStatus::done:
       // This is not supposed to happen if continuation is set
@@ -209,7 +209,7 @@ void bindPromise(Promise<T> promise, Future<T> future)
 {
   struct PromiseBinder {
   public:
-    PromiseBinder(Promise<T> promise) : promise_(std::move(promise)) {}
+    explicit PromiseBinder(Promise<T> promise) : promise_(std::move(promise)) {}
     void operator()(Future<T> future)
     {
       simgrid::xbt::setPromise(promise_, future);
@@ -282,7 +282,7 @@ template<class T>
 class Future {
 public:
   Future() = default;
-  Future(std::shared_ptr<FutureState<T>> state): state_(std::move(state)) {}
+  explicit Future(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
 
   // Move type:
   Future(Future&) = delete;
@@ -369,12 +369,9 @@ public:
    *                     the future is ready
    * @exception std::future_error no state is associated with the future
    */
-  template<class F>
-  auto then(F continuation)
-  -> typename std::enable_if<
-       !is_future<decltype(continuation(std::move(*this)))>::value,
-       Future<decltype(continuation(std::move(*this)))>
-     >::type
+  template <class F>
+  auto then(F continuation) -> typename std::enable_if<not is_future<decltype(continuation(std::move(*this)))>::value,
+                                                       Future<decltype(continuation(std::move(*this)))>>::type
   {
     return this->thenNoUnwrap(std::move(continuation));
   }
@@ -422,7 +419,7 @@ Future<T> unwrapFuture(Future<Future<T>> future)
   return std::move(result);
 }
 
-/** Producer side of a @simgrid::kernel::Future
+/** Producer side of a @ref simgrid::kernel::Future
  *
  *  A @ref Promise is connected to some `Future` and can be used to
  *  set its result.
@@ -457,8 +454,8 @@ Future<T> unwrapFuture(Future<Future<T>> future)
 template<class T>
 class Promise {
 public:
-  Promise() : state_(std::make_shared<FutureState<T>>()) {}
-  Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
+  explicit Promise() : state_(std::make_shared<FutureState<T>>()) {}
+  explicit Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
 
   // Move type
   Promise(Promise const&) = delete;