Chromium Code Reviews| Index: base/memory/ref_counted.h |
| diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h |
| index e73951481be0e5501ae2bdc73c56502d3d51d7b9..3461c008233badbc2ac7447b462473b715d9e46f 100644 |
| --- a/base/memory/ref_counted.h |
| +++ b/base/memory/ref_counted.h |
| @@ -7,6 +7,7 @@ |
| #include <cassert> |
| #include <iosfwd> |
| +#include <type_traits> |
| #include "base/atomic_ref_count.h" |
| #include "base/base_export.h" |
| @@ -283,7 +284,9 @@ class scoped_refptr { |
| } |
| // Copy conversion constructor. |
| - template <typename U> |
| + template <typename U, |
| + typename Dummy = typename std::enable_if< |
|
danakj
2016/04/19 23:19:46
nit: don't need to name it Dummy, just "typename =
piman
2016/04/19 23:24:49
Done.
|
| + std::is_convertible<U*, T*>::value>::type> |
| scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) { |
| if (ptr_) |
| AddRef(ptr_); |
| @@ -294,7 +297,9 @@ class scoped_refptr { |
| scoped_refptr(scoped_refptr&& r) : ptr_(r.get()) { r.ptr_ = nullptr; } |
| // Move conversion constructor. |
| - template <typename U> |
| + template <typename U, |
| + typename Dummy = typename std::enable_if< |
|
danakj
2016/04/19 23:19:46
ditto
piman
2016/04/19 23:24:49
Done.
|
| + std::is_convertible<U*, T*>::value>::type> |
| scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { |
| r.ptr_ = nullptr; |
| } |