Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2044)

Unified Diff: base/functional.h

Issue 2944523002: Improving flat containers interface. (Closed)
Patch Set: Review, round 2. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/functional.h
diff --git a/base/functional.h b/base/functional.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc5e8a0a113fbc22e098536a8e0a92e110aeae80
--- /dev/null
+++ b/base/functional.h
@@ -0,0 +1,28 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_FUNCTIONAL_H_
+#define BASE_FUNCTIONAL_H_
+
+#include <functional>
+#include <utility>
+
+namespace base {
+
+// std::less<> from C++14.
+// Needed for improved flat containers API.
+
+struct less {
+ template <typename T, typename U>
+ constexpr auto operator()(T&& lhs, U&& rhs) const
+ -> decltype(std::forward<T>(lhs) < std::forward<U>(rhs)) {
+ return std::forward<T>(lhs) < std::forward<U>(rhs);
+ }
+
+ using is_transparent = int;
+};
+
+} // base
+
+#endif // BASE_FUNCTIONAL_H_

Powered by Google App Engine
This is Rietveld 408576698