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

Unified Diff: base/callback_internal.h

Issue 1457673002: styleguide: Allow enable_if, conditional, and other type_traits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rare usage note Created 5 years, 1 month 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
« no previous file with comments | « base/bind_internal.h ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_internal.h
diff --git a/base/callback_internal.h b/base/callback_internal.h
index b6353dc8e568449545d541f2dece3cabd2d55286..4b47bc7978db33f0946a9c30645d4b35f241751e 100644
--- a/base/callback_internal.h
+++ b/base/callback_internal.h
@@ -9,6 +9,7 @@
#define BASE_CALLBACK_INTERNAL_H_
#include <stddef.h>
+#include <type_traits>
#include "base/atomic_ref_count.h"
#include "base/base_export.h"
@@ -105,18 +106,6 @@ template <typename T> struct IsMoveOnlyType {
!is_const<T>::value;
};
-// Returns |Then| as SelectType::Type if |condition| is true. Otherwise returns
-// |Else|.
-template <bool condition, typename Then, typename Else>
-struct SelectType {
- typedef Then Type;
-};
-
-template <typename Then, typename Else>
-struct SelectType<false, Then, Else> {
- typedef Else Type;
-};
-
template <typename>
struct CallbackParamTraitsForMoveOnlyType;
@@ -140,9 +129,9 @@ struct CallbackParamTraitsForNonMoveOnlyType;
// break passing of C-string literals.
template <typename T>
struct CallbackParamTraits
- : SelectType<IsMoveOnlyType<T>::value,
+ : std::conditional<IsMoveOnlyType<T>::value,
CallbackParamTraitsForMoveOnlyType<T>,
- CallbackParamTraitsForNonMoveOnlyType<T> >::Type {
+ CallbackParamTraitsForNonMoveOnlyType<T>>::type {
};
template <typename T>
« no previous file with comments | « base/bind_internal.h ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698