| Index: base/memory/scoped_ptr.h
|
| diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
|
| index 3547b7a15397f9c58f3c5193401d6d9defae333d..c12b98083e90e34709ae9f233c46abe8438ca7fb 100644
|
| --- a/base/memory/scoped_ptr.h
|
| +++ b/base/memory/scoped_ptr.h
|
| @@ -95,9 +95,13 @@
|
| #include <stddef.h>
|
| #include <stdlib.h>
|
|
|
| +#include <type_traits>
|
| +
|
| +
|
| #include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/move.h"
|
| +#include "base/nullptr.h"
|
| #include "base/template_util.h"
|
|
|
| namespace base {
|
| @@ -141,10 +145,15 @@ class scoped_ptr {
|
| // The element type
|
| typedef C element_type;
|
|
|
| + scoped_ptr() : ptr_(NULL) {}
|
| + scoped_ptr(base::nullptr_t) : ptr_(NULL) {}
|
| +
|
| // Constructor. Defaults to initializing with NULL.
|
| // There is no way to create an uninitialized scoped_ptr.
|
| // The input parameter must be allocated with new.
|
| - explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
|
| + template <typename V>
|
| + scoped_ptr(V p, typename std::enable_if<!std::is_integral<V>::value &&
|
| + std::is_convertible<V, C*>::value, int>::type = 0) : ptr_(p) { }
|
|
|
| // Constructor. Allows construction from a scoped_ptr rvalue for a
|
| // convertible type.
|
|
|