STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.

[libcxx] [test] Avoid unary_function.

Replace unary_function inheritance (which was never required,
even in C++98) with argument_type and result_type typedefs.
This increases portability, as unary_function was removed in C++17
and MSVC has implemented that removal.


https://reviews.llvm.org/D45596

Files:
  test/support/Counter.h


Index: test/support/Counter.h
===================================================================
--- test/support/Counter.h
+++ test/support/Counter.h
@@ -45,8 +45,10 @@
 
 template <class T>
 struct hash<Counter<T> >
-    : public std::unary_function<Counter<T>, std::size_t>
 {
+    typedef Counter<T> argument_type;
+    typedef std::size_t result_type;
+
     std::size_t operator()(const Counter<T>& x) const {return 
std::hash<T>(x.get());}
 };
 }


Index: test/support/Counter.h
===================================================================
--- test/support/Counter.h
+++ test/support/Counter.h
@@ -45,8 +45,10 @@
 
 template <class T>
 struct hash<Counter<T> >
-    : public std::unary_function<Counter<T>, std::size_t>
 {
+    typedef Counter<T> argument_type;
+    typedef std::size_t result_type;
+
     std::size_t operator()(const Counter<T>& x) const {return std::hash<T>(x.get());}
 };
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D45596: [libcxx... Stephan T. Lavavej via Phabricator via cfe-commits

Reply via email to