Flutter Engine
 
Loading...
Searching...
No Matches
impeller::raw_ptr< T > Class Template Reference

A wrapper around a raw ptr that adds additional unopt mode only checks. More...

#include <raw_ptr.h>

Public Member Functions

 raw_ptr (const std::shared_ptr< T > &ptr)
 
 raw_ptr ()
 
T * operator-> ()
 
const T * operator-> () const
 
T * get ()
 
T & operator* ()
 
const T & operator* () const
 
template<class U >
bool operator== (raw_ptr< U > const &other) const
 
template<class U >
bool operator!= (raw_ptr< U > const &other) const
 
 operator bool () const
 

Detailed Description

template<typename T>
class impeller::raw_ptr< T >

A wrapper around a raw ptr that adds additional unopt mode only checks.

Definition at line 15 of file raw_ptr.h.

Constructor & Destructor Documentation

◆ raw_ptr() [1/2]

template<typename T >
impeller::raw_ptr< T >::raw_ptr ( const std::shared_ptr< T > &  ptr)
inlineexplicit

Definition at line 17 of file raw_ptr.h.

18 : ptr_(ptr.get())
19#if !NDEBUG
20 ,
21 weak_ptr_(ptr)
22#endif
23 {
24 }

References if().

◆ raw_ptr() [2/2]

template<typename T >
impeller::raw_ptr< T >::raw_ptr ( )
inline

Definition at line 26 of file raw_ptr.h.

26: ptr_(nullptr) {}

Member Function Documentation

◆ get()

template<typename T >
T * impeller::raw_ptr< T >::get ( )
inline

Definition at line 42 of file raw_ptr.h.

42 {
43#if !NDEBUG
44 FML_CHECK(weak_ptr_.lock());
45#endif
46 return ptr_;
47 }
#define FML_CHECK(condition)
Definition logging.h:104

References FML_CHECK.

◆ operator bool()

template<typename T >
impeller::raw_ptr< T >::operator bool ( ) const
inlineexplicit

Definition at line 73 of file raw_ptr.h.

73{ return !!ptr_; }

◆ operator!=()

template<typename T >
template<class U >
bool impeller::raw_ptr< T >::operator!= ( raw_ptr< U > const &  other) const
inline

Definition at line 69 of file raw_ptr.h.

69 {
70 return !(*this == other);
71 }

◆ operator*() [1/2]

template<typename T >
T & impeller::raw_ptr< T >::operator* ( )
inline

Definition at line 49 of file raw_ptr.h.

49 {
50#if !NDEBUG
51 FML_CHECK(weak_ptr_.lock());
52#endif
53 return *ptr_;
54 }

References FML_CHECK.

◆ operator*() [2/2]

template<typename T >
const T & impeller::raw_ptr< T >::operator* ( ) const
inline

Definition at line 56 of file raw_ptr.h.

56 {
57#if !NDEBUG
58 FML_CHECK(weak_ptr_.lock());
59#endif
60 return *ptr_;
61 }

References FML_CHECK.

◆ operator->() [1/2]

template<typename T >
T * impeller::raw_ptr< T >::operator-> ( )
inline

Definition at line 28 of file raw_ptr.h.

28 {
29#if !NDEBUG
30 FML_CHECK(weak_ptr_.lock());
31#endif
32 return ptr_;
33 }

References FML_CHECK.

◆ operator->() [2/2]

template<typename T >
const T * impeller::raw_ptr< T >::operator-> ( ) const
inline

Definition at line 35 of file raw_ptr.h.

35 {
36#if !NDEBUG
37 FML_CHECK(weak_ptr_.lock());
38#endif
39 return ptr_;
40 }

References FML_CHECK.

◆ operator==()

template<typename T >
template<class U >
bool impeller::raw_ptr< T >::operator== ( raw_ptr< U > const &  other) const
inline

Definition at line 64 of file raw_ptr.h.

64 {
65 return ptr_ == other.ptr_;
66 }

The documentation for this class was generated from the following file: