Lines Matching defs:scoped_ptr

10 #include <boost/scoped_ptr.hpp>
11 using boost::scoped_ptr;
16 // implementation of the scoped_ptr class and scoped_ptr_malloc (deprecated).
32 // invokes 'delete'. The default deleter for scoped_ptr<T>.
81 // Never allow someone to declare something like scoped_ptr<int[10]>.
86 // a pointer. Can be used to store malloc-allocated pointers in scoped_ptr:
88 // scoped_ptr<int, base::FreeDeleter> foo_ptr(
96 // Minimal implementation of the core logic of scoped_ptr, suitable for
97 // reuse in both scoped_ptr and its specializations.
144 // dereferences the scoped_ptr when it is destroyed by a call to reset(),
198 // A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
200 // That is, scoped_ptr<T> owns the T object that it points to.
201 // Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
202 // Also like T*, scoped_ptr<T> is thread-compatible, and once you
205 // The size of scoped_ptr is small. On most compilers, when using the
206 // DefaultDeleter, sizeof(scoped_ptr<T>) == sizeof(T*). Custom deleters will
215 class scoped_ptr {
222 scoped_ptr() : impl_(NULL) { }
225 explicit scoped_ptr(element_type* p) : impl_(p) { }
228 scoped_ptr(element_type* p, const D& d) : impl_(p, d) { }
230 // Constructor. Allows construction from a scoped_ptr rvalue for a
239 // implementation of scoped_ptr.
241 scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
245 // operator=. Allows assignment from a scoped_ptr rvalue for a convertible
254 // scoped_ptr.
256 scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
282 // Allow scoped_ptr<element_type> to be used in boolean expressions, but not
285 typedef scoped_ptr_impl<element_type, deleter_type> scoped_ptr::*Testable;
288 operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
291 // These return whether two scoped_ptr refer to the same object, not just to
297 void swap(scoped_ptr& p2) {
312 template <typename U, typename V> friend class scoped_ptr;
315 // Forbid comparison of scoped_ptr types. If U != T, it totally
319 template <class U> bool operator==(scoped_ptr<U> const& p2) const;
320 template <class U> bool operator!=(scoped_ptr<U> const& p2) const;
324 class scoped_ptr<T[], D> {
331 scoped_ptr() : impl_(NULL) { }
349 explicit scoped_ptr(element_type* array) : impl_(array) { }
366 // Allow scoped_ptr<element_type> to be used in boolean expressions, but not
369 typedef scoped_ptr_impl<element_type, deleter_type> scoped_ptr::*Testable;
372 operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
375 // These return whether two scoped_ptr refer to the same object, not just to
381 void swap(scoped_ptr& p2) {
406 template <typename U> explicit scoped_ptr(U* array);
407 explicit scoped_ptr(int disallow_construction_from_null);
414 // Forbid comparison of scoped_ptr types. If U != T, it totally
418 template <class U> bool operator==(scoped_ptr<U> const& p2) const;
419 template <class U> bool operator!=(scoped_ptr<U> const& p2) const;
424 void swap(scoped_ptr<T, D>& p1, scoped_ptr<T, D>& p2) {
429 bool operator==(T* p1, const scoped_ptr<T, D>& p2) {
434 bool operator!=(T* p1, const scoped_ptr<T, D>& p2) {
438 // A function to convert T* into scoped_ptr<T>
440 // for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
442 scoped_ptr<T> make_scoped_ptr(T* ptr) {
443 return scoped_ptr<T>(ptr);