9 #ifndef CPROVER_UTIL_SMALL_SHARED_PTR_H
10 #define CPROVER_UTIL_SMALL_SHARED_PTR_H
79 std::swap(
t_, rhs.
t_);
102 explicit operator bool()
const
104 return t_ !=
nullptr;
111 template <
typename T>
114 return os << ptr.
get();
122 template <
typename T,
typename... Ts>
128 template <
typename T,
typename U>
133 return lhs.
get() == rhs.
get();
136 template <
typename T,
typename U>
141 return lhs.
get() != rhs.
get();
144 template <
typename T,
typename U>
147 return lhs.
get() < rhs.
get();
150 template <
typename T,
typename U>
153 return lhs.
get() > rhs.
get();
156 template <
typename T,
typename U>
161 return lhs.
get() <= rhs.
get();
164 template <
typename T,
typename U>
169 return lhs.
get() >= rhs.
get();
181 template <
typename Num>
232 template <
typename Num>
238 template <
typename Num>
244 template <
typename Num>
A helper class to store use-counts of objects held by small shared pointers.
~small_shared_pointeet()=default
small_shared_pointeet & operator=(small_shared_pointeet &&)
small_shared_pointeet()=default
void decrement_use_count()
small_shared_pointeet & operator=(const small_shared_pointeet &)
small_shared_pointeet(const small_shared_pointeet &)
small_shared_pointeet(small_shared_pointeet &&)
void increment_use_count()
This class is really similar to boost's intrusive_pointer, but can be a bit simpler seeing as we're o...
small_shared_ptrt()=default
auto use_count() const -> decltype(pointee_use_count(std::declval< T >()))
small_shared_ptrt(const small_shared_ptrt &rhs)
small_shared_ptrt & operator=(small_shared_ptrt &&rhs)
small_shared_ptrt(small_shared_ptrt &&rhs)
small_shared_ptrt & operator=(const small_shared_ptrt &rhs)
void swap(small_shared_ptrt &rhs)
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...
void pointee_decrement_use_count(small_shared_pointeet< Num > &p)
bool operator<(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
bool operator>=(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
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 ...
bool operator>(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
std::ostream & operator<<(std::ostream &os, const small_shared_ptrt< T > &ptr)
bool operator<=(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
bool operator==(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)
Num pointee_use_count(const small_shared_pointeet< Num > &p)
bool operator!=(const small_shared_ptrt< T > &lhs, const small_shared_ptrt< U > &rhs)