summaryrefslogtreecommitdiffstats
path: root/base/memory
diff options
context:
space:
mode:
authortzik <tzik@chromium.org>2016-03-09 23:17:25 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-10 07:19:09 +0000
commit403cb6c9b17343999f09df79b82b56e77bd93839 (patch)
tree4c072eb309fc7e1245e908ce2a8130541e555a42 /base/memory
parent2df71fea360d6abde88d9c0de8fe084cb95f670e (diff)
downloadchromium_src-403cb6c9b17343999f09df79b82b56e77bd93839.zip
chromium_src-403cb6c9b17343999f09df79b82b56e77bd93839.tar.gz
chromium_src-403cb6c9b17343999f09df79b82b56e77bd93839.tar.bz2
Replace template_util.h stuff with C++11 <type_traits>
BUG=554293 Review URL: https://codereview.chromium.org/1774443002 Cr-Commit-Position: refs/heads/master@{#380369}
Diffstat (limited to 'base/memory')
-rw-r--r--base/memory/raw_scoped_refptr_mismatch_checker.h18
-rw-r--r--base/memory/scoped_ptr.h5
-rw-r--r--base/memory/weak_ptr.h7
3 files changed, 12 insertions, 18 deletions
diff --git a/base/memory/raw_scoped_refptr_mismatch_checker.h b/base/memory/raw_scoped_refptr_mismatch_checker.h
index 1e88b48..5dbc183 100644
--- a/base/memory/raw_scoped_refptr_mismatch_checker.h
+++ b/base/memory/raw_scoped_refptr_mismatch_checker.h
@@ -5,10 +5,10 @@
#ifndef BASE_MEMORY_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
#define BASE_MEMORY_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
+#include <tuple>
+#include <type_traits>
+
#include "base/memory/ref_counted.h"
-#include "base/template_util.h"
-#include "base/tuple.h"
-#include "build/build_config.h"
// It is dangerous to post a task with a T* argument where T is a subtype of
// RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the
@@ -25,20 +25,14 @@ namespace internal {
template <typename T>
struct NeedsScopedRefptrButGetsRawPtr {
-#if defined(OS_WIN)
- enum {
- value = base::false_type::value
- };
-#else
enum {
// Human readable translation: you needed to be a scoped_refptr if you are a
// raw pointer type and are convertible to a RefCounted(Base|ThreadSafeBase)
// type.
- value = (is_pointer<T>::value &&
- (is_convertible<T, subtle::RefCountedBase*>::value ||
- is_convertible<T, subtle::RefCountedThreadSafeBase*>::value))
+ value = (std::is_pointer<T>::value &&
+ (std::is_convertible<T, subtle::RefCountedBase*>::value ||
+ std::is_convertible<T, subtle::RefCountedThreadSafeBase*>::value))
};
-#endif
};
template <typename Params>
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
index 358e9f1..db0d04b 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -102,7 +102,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/move.h"
-#include "base/template_util.h"
#include "build/build_config.h"
namespace base {
@@ -179,8 +178,8 @@ namespace internal {
template <typename T> struct IsNotRefCounted {
enum {
- value = !base::is_convertible<T*, base::subtle::RefCountedBase*>::value &&
- !base::is_convertible<T*, base::subtle::RefCountedThreadSafeBase*>::
+ value = !std::is_convertible<T*, base::subtle::RefCountedBase*>::value &&
+ !std::is_convertible<T*, base::subtle::RefCountedThreadSafeBase*>::
value
};
};
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h
index 4e50c27..9ba5e25 100644
--- a/base/memory/weak_ptr.h
+++ b/base/memory/weak_ptr.h
@@ -70,12 +70,13 @@
#ifndef BASE_MEMORY_WEAK_PTR_H_
#define BASE_MEMORY_WEAK_PTR_H_
+#include <type_traits>
+
#include "base/base_export.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_checker.h"
-#include "base/template_util.h"
namespace base {
@@ -160,8 +161,8 @@ class SupportsWeakPtrBase {
// function that makes calling this easier.
template<typename Derived>
static WeakPtr<Derived> StaticAsWeakPtr(Derived* t) {
- typedef
- is_convertible<Derived, internal::SupportsWeakPtrBase&> convertible;
+ using convertible =
+ std::is_convertible<Derived*, internal::SupportsWeakPtrBase*>;
static_assert(convertible::value,
"AsWeakPtr argument must inherit from SupportsWeakPtr");
return AsWeakPtrImpl<Derived>(t, *t);