13 #ifndef __UT_COWVALUE_H__
14 #define __UT_COWVALUE_H__
36 template <
typename... Args>
38 :
myRep(new Rep(std::in_place, std::forward<Args>(
args)...))
168 inline const static exint IMMORTAL_REF_COUNT = -1;
173 Rep() : myData{}, myRefCount(1) {}
176 template <
typename... Args>
178 : myData(std::forward<Args>(
args)...), myRefCount(1)
183 explicit Rep(ImmortalTag) : myData{}, myRefCount{IMMORTAL_REF_COUNT} {}
187 Rep(
const Rep &other) =
delete;
198 return myRefCount.
relaxedLoad() == IMMORTAL_REF_COUNT;
206 const T *
data()
const {
return &myData; }
212 static const Rep theInstance{ImmortalTag{}};
258 template <
typename T>
259 struct DefaultClearer;
261 template <
typename S>
270 static const bool clearNeedsDestruction =
false;
274 #endif // __UT_COWVALUE_H__
static void clearConstruct(UT_COWValue< S > *p)
UT_COWValue & operator=(const UT_COWValue &other)
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
Rep(std::in_place_t, Args &&...args)
static const UT_COWValue< T > & getStaticEmpty()
static const Rep * getStaticEmpty()
static void clear(UT_COWValue< S > &v)
constexpr SYS_MemoryOrder SYS_MEMORY_ORDER_ACQ_REL
UT_COWValue(UT_COWValue &&other) noexcept
#define utZoneScopedN(name)
UT_COWValue & operator=(UT_COWValue &&other) noexcept
const T * operator->() const
T load(SYS_MemoryOrder order=SYS_MEMORY_ORDER_SEQ_CST) const
UT_COWValue(const UT_COWValue &other)
UT_COWValue(std::in_place_t, Args &&...args)
constexpr SYS_MemoryOrder SYS_MEMORY_ORDER_RELAXED
Any reordering the compiler or hardware chooses to do is okay.
SYS_FORCE_INLINE T relaxedLoad() const
VULKAN_HPP_CONSTEXPR_14 VULKAN_HPP_INLINE T exchange(T &obj, U &&newValue)
**If you just want to fire and args
T add(T val)
Atomically adds val to myValue, returning the new value of myValue.
Rep & operator=(const Rep &other)=delete
const T & operator*() const
void swap(UT_COWValue< T > &other)
constexpr SYS_MemoryOrder SYS_MEMORY_ORDER_ACQUIRE
static bool isClear(const UT_COWValue< S > &v)