Chromium Code Reviews| 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 |
|
vmpstr
2017/06/26 15:35:53
"bool operator(...) const", since std::less::opera
dyaroshev
2017/06/26 16:19:29
This is how std::less is defined http://en.cpprefe
vmpstr
2017/06/26 16:27:32
Oh interesting. I was just looking at general std:
|
| + -> 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_ |