9#ifndef LLDB_UTILITY_NONNULLSHAREDPTR_H
10#define LLDB_UTILITY_NONNULLSHAREDPTR_H
27 using Base = std::shared_ptr<T>;
31 :
Base(t ? t : std::make_shared<T>()) {
32 assert(t &&
"NonNullSharedPtr constructed from nullptr");
36 const auto b =
static_cast<bool>(*this);
37 assert(b &&
"NonNullSharedPtr constructed from nullptr");
39 Base::operator=(std::make_shared<T>());
47 Base::operator=(other);
52 Base::operator=(std::move(other));
56 using Base::operator*;
57 using Base::operator->;
59 using Base::use_count;
60 using Base::operator
bool;
void swap(lldb_private::NonNullSharedPtr< T > &lhs, lldb_private::NonNullSharedPtr< T > &rhs)
Specialized swap function for NonNullSharedPtr to enable argument-dependent lookup (ADL) and efficien...
A non-nullable shared pointer that always holds a valid object.
NonNullSharedPtr(const std::shared_ptr< T > &t)
NonNullSharedPtr(NonNullSharedPtr &&other)
void swap(NonNullSharedPtr &other)
void reset()=delete
Explicitly deleted operations that could introduce nullptr.
void reset(T *ptr)=delete
NonNullSharedPtr(const NonNullSharedPtr &other)
NonNullSharedPtr(std::shared_ptr< T > &&t)
NonNullSharedPtr & operator=(NonNullSharedPtr &&other)
NonNullSharedPtr & operator=(const NonNullSharedPtr &other)
std::shared_ptr< T > Base
A class that represents a running process on the host machine.