25 const T *data_ =
nullptr;
41 this->add_user(data_);
46 other.data_ =
nullptr;
51 requires std::is_base_of_v<T, U>
52 : data_(
static_cast<const U *
>(other.data_))
54 this->add_user(data_);
59 requires std::is_base_of_v<T, U>
60 : data_(
static_cast<U *
>(other.data_))
62 other.data_ =
nullptr;
67 this->remove_user_and_delete_if_last(data_);
76 this->remove_user_and_delete_if_last(data_);
78 this->add_user(data_);
88 this->remove_user_and_delete_if_last(data_);
90 other.data_ =
nullptr;
106 operator bool()
const
108 return data_ !=
nullptr;
118 const T *
data = data_;
125 this->remove_user_and_delete_if_last(data_);
131 return data_ !=
nullptr;
147 if (!data_->is_mutable()) {
149 *
this = data_->copy();
152 data_->tag_ensured_mutable();
153 return const_cast<T &
>(*data_);
174 static void add_user(
const T *
data)
176 if (
data !=
nullptr) {
177 if constexpr (IsStrong) {
181 data->add_weak_user();
186 static void remove_user_and_delete_if_last(
const T *
data)
188 if (
data !=
nullptr) {
189 if constexpr (IsStrong) {
190 data->remove_user_and_delete_if_last();
193 data->remove_weak_user_and_delete_if_last();
229 if (
this == &other) {
232 std::destroy_at(
this);
239 if (
this == &other) {
242 std::destroy_at(
this);
249 this->data =
nullptr;
ImplicitSharingPtrAndData & operator=(const ImplicitSharingPtrAndData &other)
ImplicitSharingPtrAndData & operator=(ImplicitSharingPtrAndData &&other)
ImplicitSharingPtrAndData()=default
~ImplicitSharingPtrAndData()
ImplicitSharingPtrAndData(ImplicitSharingPtr<> sharing_info, const void *data)
ImplicitSharingPtr sharing_info
ImplicitSharingPtrAndData(const ImplicitSharingPtrAndData &other)=default
ImplicitSharingPtrAndData(ImplicitSharingPtrAndData &&other)
friend bool operator==(const ImplicitSharingPtr &a, const T *b)
friend class ImplicitSharingPtr
T & ensure_mutable_inplace()
ImplicitSharingPtr & operator=(ImplicitSharingPtr &&other)
friend bool operator==(const ImplicitSharingPtr &a, const ImplicitSharingPtr &b)=default
ImplicitSharingPtr(const T *data)
ImplicitSharingPtr(ImplicitSharingPtr &&other)
static uint64_t hash_as(const T *data)
ImplicitSharingPtr()=default
friend bool operator==(const T *a, const ImplicitSharingPtr &b)
ImplicitSharingPtr & operator=(const ImplicitSharingPtr &other)
const T * operator->() const
ImplicitSharingPtr(std::nullptr_t)
ImplicitSharingPtr(const ImplicitSharingPtr &other)
const T & operator*() const
ImplicitSharingPtr(ImplicitSharingPtr< U, IsStrong > &&other)
ImplicitSharingPtr(const ImplicitSharingPtr< U, IsStrong > &other)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
ImplicitSharingPtr< ImplicitSharingInfo, false > WeakImplicitSharingPtr
BMesh const char void * data
static constexpr bool is_ImplicitSharingPtr_strong_v
constexpr uint64_t get_default_hash(const T &v, const Args &...args)