[PATCH] D45596: [libcxx] [test] Avoid unary_function.

Stephan T. Lavavej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 12 15:20:07 PDT 2018


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());}
 };
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45596.142274.patch
Type: text/x-patch
Size: 454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180412/765c101e/attachment.bin>


More information about the cfe-commits mailing list