Home | History | Annotate | Download | only in memory

Lines Matching full:scoped_refptr

229 //     scoped_refptr<MyFoo> foo = new MyFoo();
235 // scoped_refptr<MyFoo> foo = new MyFoo();
243 // The above examples show how scoped_refptr<T> acts like a pointer to T.
244 // Given two scoped_refptr<T> classes, it is also possible to exchange
248 // scoped_refptr<MyFoo> a = new MyFoo();
249 // scoped_refptr<MyFoo> b;
259 // scoped_refptr<MyFoo> a = new MyFoo();
260 // scoped_refptr<MyFoo> b;
267 class scoped_refptr {
271 scoped_refptr() : ptr_(NULL) {
274 scoped_refptr(T* p) : ptr_(p) {
280 scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
287 scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
294 scoped_refptr(scoped_refptr&& r) : ptr_(r.get()) { r.ptr_ = nullptr; }
298 scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) {
302 ~scoped_refptr() {
319 scoped_refptr<T>& operator=(T* p) {
330 scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
335 scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
339 scoped_refptr<T>& operator=(scoped_refptr<T>&& r) {
340 scoped_refptr<T>(std::move(r)).swap(*this);
345 scoped_refptr<T>& operator=(scoped_refptr<U>&& r) {
346 scoped_refptr<T>(std::move(r)).swap(*this);
356 void swap(scoped_refptr<T>& r) {
361 template <typename U> friend class scoped_refptr;
363 // Allow scoped_refptr<T> to be used in boolean expressions, but not
370 typedef T* scoped_refptr::*Testable;
373 operator Testable() const { return ptr_ ? &scoped_refptr::ptr_ : nullptr; }
376 bool operator==(const scoped_refptr<U>& rhs) const {
381 bool operator!=(const scoped_refptr<U>& rhs) const {
386 bool operator<(const scoped_refptr<U>& rhs) const {
396 // extern template class scoped_refptr<Opaque>;
403 void scoped_refptr<T>::AddRef(T* ptr) {
408 void scoped_refptr<T>::Release(T* ptr) {
412 // Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
415 scoped_refptr<T> make_scoped_refptr(T* t) {
416 return scoped_refptr<T>(t);
422 bool operator==(const scoped_refptr<T>& lhs, const U* rhs) {
427 bool operator==(const T* lhs, const scoped_refptr<U>& rhs) {
432 bool operator!=(const scoped_refptr<T>& lhs, const U* rhs) {
437 bool operator!=(const T* lhs, const scoped_refptr<U>& rhs) {
442 std::ostream& operator<<(std::ostream& out, const scoped_refptr<T>& p) {