1#ifndef IPFS_OBSERVER_PTR_H_
2#define IPFS_OBSERVER_PTR_H_
4#if __has_include("base/memory/raw_ptr.h")
5#include "base/memory/raw_ptr.h"
9using raw_ptr = base::raw_ptr<T>;
12#elif defined(__has_cpp_attribute) && \
13 __has_cpp_attribute(__cpp_lib_experimental_observer_ptr)
14#include <experimental/memory>
18using raw_ptr = std::experimental::observer_ptr<T>;
48 T* get() {
return ptr_; }
49 T
const* get()
const {
return ptr_; }
50 explicit operator bool()
const {
return !!ptr_; }
51 T* operator->() {
return ptr_; }
52 T
const* operator->()
const {
return ptr_; }
53 raw_ptr& operator=(T* p) {
Just an observing (non-owning) pointer.
Definition raw_ptr.h:31
raw_ptr(T *p)
Definition raw_ptr.h:42