Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define and use utility class to compare pairs in priority queues.
[simgrid.git] / include / xbt / functional.hpp
index a05a254..64c3caa 100644 (file)
@@ -130,8 +130,8 @@ private:
     std::pair<void(whatever::*)(), whatever*> memberptr;
     char any1[sizeof(std::pair<void(*)(),void*>)];
     char any2[sizeof(std::pair<void(whatever::*)(), whatever*>)];
-    TaskUnion() {}
-    ~TaskUnion() {}
+    TaskUnion() { /* Nothing to do */}
+    ~TaskUnion() { /* Nothing to do */}
   };
 #endif
 
@@ -170,9 +170,8 @@ private:
   }
 
 public:
-
-  Task() {}
-  Task(std::nullptr_t) {}
+  Task() { /* Nothing to do */}
+  Task(std::nullptr_t) { /* Nothing to do */}
   ~Task()
   {
     this->clear();
@@ -209,11 +208,11 @@ private:
   {
     const static TaskVtable vtable {
       // Call:
-      [](TaskUnion& buffer, Args... args) -> R {
+      [](TaskUnion& buffer, Args... args) {
         F* src = reinterpret_cast<F*>(&buffer);
         F code = std::move(*src);
         src->~F();
-        code(std::forward<Args>(args)...);
+        return code(std::forward<Args>(args)...);
       },
       // Destroy:
       std::is_trivially_destructible<F>::value ?
@@ -238,7 +237,7 @@ private:
   {
     const static TaskVtable vtable {
       // Call:
-      [](TaskUnion& buffer, Args... args) -> R {
+      [](TaskUnion& buffer, Args... args) {
         // Delete F when we go out of scope:
         std::unique_ptr<F> code(*reinterpret_cast<F**>(&buffer));
         return (*code)(std::forward<Args>(args)...);