Remove uses of std::unary_function and std::binary_function. This patch removes unary and binary function, since those are deprecated in C++11. They also only provide two typedefs, so this cleans up some code. In rare cases where the typedefs are actually required, it's easier to just provide the typedef directly instead of deriving from one of these functions. BUG=593407 Review URL: https://codereview.chromium.org/1420333006 Cr-Original-Commit-Position: refs/heads/master@{#380179} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 3abe3303bcbb2b24d7c21228f88114337347b674
diff --git a/tools/gn/label_ptr.h b/tools/gn/label_ptr.h index 4ce20a6..c0b2d63 100644 --- a/tools/gn/label_ptr.h +++ b/tools/gn/label_ptr.h
@@ -56,7 +56,7 @@ // To do a brute-force search by label: // std::find_if(vect.begin(), vect.end(), LabelPtrLabelEquals<Config>(label)); template<typename T> -struct LabelPtrLabelEquals : public std::unary_function<Label, bool> { +struct LabelPtrLabelEquals { explicit LabelPtrLabelEquals(const Label& l) : label(l) {} bool operator()(const LabelPtrPair<T>& arg) const { @@ -69,7 +69,7 @@ // To do a brute-force search by object pointer: // std::find_if(vect.begin(), vect.end(), LabelPtrPtrEquals<Config>(config)); template<typename T> -struct LabelPtrPtrEquals : public std::unary_function<T, bool> { +struct LabelPtrPtrEquals { explicit LabelPtrPtrEquals(const T* p) : ptr(p) {} bool operator()(const LabelPtrPair<T>& arg) const { @@ -82,9 +82,7 @@ // To sort by label: // std::sort(vect.begin(), vect.end(), LabelPtrLabelLess<Config>()); template<typename T> -struct LabelPtrLabelLess : public std::binary_function<LabelPtrPair<T>, - LabelPtrPair<T>, - bool> { +struct LabelPtrLabelLess { bool operator()(const LabelPtrPair<T>& a, const LabelPtrPair<T>& b) const { return a.label < b.label; }