[libcxx] r329974 - [libcxx] [test] Avoid unary_function.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 12 16:56:10 PDT 2018


Author: stl_msft
Date: Thu Apr 12 16:56:10 2018
New Revision: 329974

URL: http://llvm.org/viewvc/llvm-project?rev=329974&view=rev
Log:
[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.

Fixes D45596.

Modified:
    libcxx/trunk/test/support/Counter.h

Modified: libcxx/trunk/test/support/Counter.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/Counter.h?rev=329974&r1=329973&r2=329974&view=diff
==============================================================================
--- libcxx/trunk/test/support/Counter.h (original)
+++ libcxx/trunk/test/support/Counter.h Thu Apr 12 16:56:10 2018
@@ -45,8 +45,10 @@ namespace std {
 
 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());}
 };
 }




More information about the cfe-commits mailing list