CBMC
small_shared_ptr.h File Reference
#include <iosfwd>
#include <utility>
+ Include dependency graph for small_shared_ptr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  small_shared_ptrt< T >
 This class is really similar to boost's intrusive_pointer, but can be a bit simpler seeing as we're only using it one place. More...
 
class  small_shared_pointeet< Num >
 A helper class to store use-counts of objects held by small shared pointers. More...
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &os, const small_shared_ptrt< T > &ptr)
 
template<typename T , typename... Ts>
small_shared_ptrt< T > make_small_shared_ptr (Ts &&... ts)
 This function is similar to std::make_unique and std::make_shared, and should be the preferred way of creating small_shared_ptrs. More...
 
template<typename T , typename U >
bool operator== (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename T , typename U >
bool operator!= (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename T , typename U >
bool operator< (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename T , typename U >
bool operator> (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename T , typename U >
bool operator<= (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename T , typename U >
bool operator>= (const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
 
template<typename Num >
void pointee_increment_use_count (small_shared_pointeet< Num > &p)
 The following functions are required by small_shared_ptrt, and by default pass through to the member functions of small_shared_pointeet by the same name. More...
 
template<typename Num >
void pointee_decrement_use_count (small_shared_pointeet< Num > &p)
 
template<typename Num >
Num pointee_use_count (const small_shared_pointeet< Num > &p)
 

Function Documentation

◆ make_small_shared_ptr()

template<typename T , typename... Ts>
small_shared_ptrt<T> make_small_shared_ptr ( Ts &&...  ts)

This function is similar to std::make_unique and std::make_shared, and should be the preferred way of creating small_shared_ptrs.

The public constructors of small_shared_ptr are just provided to keep the class design similar to that of unique_ptr and shared_ptr, but in practice they should not be used directly.

Definition at line 123 of file small_shared_ptr.h.

◆ operator!=()

template<typename T , typename U >
bool operator!= ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 137 of file small_shared_ptr.h.

◆ operator<()

template<typename T , typename U >
bool operator< ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 145 of file small_shared_ptr.h.

◆ operator<<()

template<typename T >
std::ostream& operator<< ( std::ostream &  os,
const small_shared_ptrt< T > &  ptr 
)

Definition at line 112 of file small_shared_ptr.h.

◆ operator<=()

template<typename T , typename U >
bool operator<= ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 157 of file small_shared_ptr.h.

◆ operator==()

template<typename T , typename U >
bool operator== ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 129 of file small_shared_ptr.h.

◆ operator>()

template<typename T , typename U >
bool operator> ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 151 of file small_shared_ptr.h.

◆ operator>=()

template<typename T , typename U >
bool operator>= ( const small_shared_ptrt< T > &  lhs,
const small_shared_ptrt< U > &  rhs 
)

Definition at line 165 of file small_shared_ptr.h.

◆ pointee_decrement_use_count()

template<typename Num >
void pointee_decrement_use_count ( small_shared_pointeet< Num > &  p)
inline

Definition at line 239 of file small_shared_ptr.h.

◆ pointee_increment_use_count()

template<typename Num >
void pointee_increment_use_count ( small_shared_pointeet< Num > &  p)
inline

The following functions are required by small_shared_ptrt, and by default pass through to the member functions of small_shared_pointeet by the same name.

We provide these as non-members just in case a future client wants to implement a shared object, which is unable to inherit from small_shared_pointeet for some reason. In this case, new overloads for the functions below can be provided, with appropriate behavior for the new type.

Definition at line 233 of file small_shared_ptr.h.

◆ pointee_use_count()

template<typename Num >
Num pointee_use_count ( const small_shared_pointeet< Num > &  p)
inline

Definition at line 245 of file small_shared_ptr.h.