From 9e22f23863ee776ec2534c9a428d631d09973270 Mon Sep 17 00:00:00 2001
From: "w.klijn" <nonoice@gmail.com>
Date: Wed, 17 Aug 2016 11:21:31 +0200
Subject: [PATCH] Remove the do_nothing function, and use Sam, fancy thingy

---
 miniapp/miniapp.cpp | 12 +++++++-----
 src/io/exporter.hpp |  4 ----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/miniapp/miniapp.cpp b/miniapp/miniapp.cpp
index 9f98b08f..cf7592cd 100644
--- a/miniapp/miniapp.cpp
+++ b/miniapp/miniapp.cpp
@@ -19,6 +19,7 @@
 #include <profiling/profiler.hpp>
 #include <threading/threading.hpp>
 #include <util/ioutil.hpp>
+#include <util/nop.hpp>
 #include <util/optional.hpp>
 
 #include "io.hpp"
@@ -70,10 +71,11 @@ int main(int argc, char** argv) {
 
         // File output is depending on the input arguments
         std::unique_ptr<file_export_type> file_exporter;
+        std::function<void(const std::vector<spike_type>&)> do_nothing{
+            util::nop_function };
         if (!options.spike_file_output) {
-            // TODO: use the no_function if PR:77
-            m.set_global_spike_callback(file_export_type::do_nothing);
-            m.set_local_spike_callback(file_export_type::do_nothing);
+            m.set_global_spike_callback(do_nothing);
+            m.set_local_spike_callback(do_nothing);
         }
         else {
             // The exporter is the same for both global and local output
@@ -84,7 +86,7 @@ int main(int argc, char** argv) {
                     options.file_extention, options.over_write);
 
             if (options.single_file_per_rank) {
-                    m.set_global_spike_callback(file_export_type::do_nothing);
+                    m.set_global_spike_callback(do_nothing);
                     m.set_local_spike_callback(
                         [&](const std::vector<spike_type>& spikes) {
                             file_exporter->output(spikes);
@@ -95,7 +97,7 @@ int main(int argc, char** argv) {
                      [&](const std::vector<spike_type>& spikes) {
                         file_exporter->output(spikes);
                      });
-                 m.set_local_spike_callback(file_export_type::do_nothing);
+                 m.set_local_spike_callback(do_nothing);
              }
         }
 
diff --git a/src/io/exporter.hpp b/src/io/exporter.hpp
index de093aee..a5885b7b 100644
--- a/src/io/exporter.hpp
+++ b/src/io/exporter.hpp
@@ -26,10 +26,6 @@ public:
 
     // Returns the status of the exporter
     virtual bool good() const = 0;
-
-    // Static version of the do_export function for NOP callbacks
-    static void do_nothing(const std::vector<spike_type>&)
-    {}
 };
 
 } //communication
-- 
GitLab