[glibmm/kjellahl/meson-build-master] examples/thread/dispatcher.cc: Make C++17 compliant



commit 5f7f9b2ff378924f5d66bed2036df578188d96e1
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Mar 2 17:05:09 2020 +0800

    examples/thread/dispatcher.cc: Make C++17 compliant
    
    std::mem_fun() and std::unary() have been removed from C++17, so port
    away from using these.

 examples/thread/dispatcher.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/examples/thread/dispatcher.cc b/examples/thread/dispatcher.cc
index ecd18a7d..2ec35780 100644
--- a/examples/thread/dispatcher.cc
+++ b/examples/thread/dispatcher.cc
@@ -76,8 +76,10 @@ private:
 };
 
 template <class T>
-class DeletePtr : public std::unary_function<void, T>
+class DeletePtr
 {
+  typedef void argument_type;
+  typedef T result_type;
 public:
   void operator()(T ptr) const { delete ptr; }
 };
@@ -193,7 +195,7 @@ Application::launch_threads()
   std::cout << "Launching " << progress_threads_.size() << " threads:" << std::endl;
 
   std::for_each(
-    progress_threads_.begin(), progress_threads_.end(), std::mem_fun(&ThreadProgress::launch));
+    progress_threads_.begin(), progress_threads_.end(), std::mem_fn(&ThreadProgress::launch));
 }
 
 void
@@ -205,7 +207,7 @@ Application::on_progress_finished(ThreadProgress* thread_progress)
 
   // Quit if it was the last thread to be joined.
   if (std::find_if(progress_threads_.begin(), progress_threads_.end(),
-        std::mem_fun(&ThreadProgress::unfinished)) == progress_threads_.end())
+        std::mem_fn(&ThreadProgress::unfinished)) == progress_threads_.end())
   {
     main_loop_->quit();
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]