8 #ifndef PXR_BASE_TF_DELEGATED_COUNT_PTR_H
9 #define PXR_BASE_TF_DELEGATED_COUNT_PTR_H
18 #include <type_traits>
62 template <
typename ValueType>
79 std::integral_constant<
83 std::integral_constant<
87 std::integral_constant<
90 std::integral_constant<bool, noexcept(*std::declval<RawPtrType>())>;
93 template <
typename ConvertibleType>
94 using _IsPtrConvertible = std::is_convertible<
95 std::add_pointer_t<ConvertibleType>,
RawPtrType>;
106 _pointer{rawPointer} {
115 _pointer{rawPointer} {
123 _pointer{
ptr.get()} {
130 template <
typename OtherType>
135 _pointer(ptr.
get()) {
144 ptr._pointer =
nullptr;
160 template <
typename OtherType>
164 static_assert(_IsPtrConvertible<OtherType>::value);
175 _pointer =
ptr.get();
176 ptr._pointer =
nullptr;
206 explicit operator bool() const noexcept {
return get(); }
209 template <
typename OtherType>
212 return get() == other.get();
216 template <
typename OtherType>
219 return get() != other.get();
223 template <
typename OtherType>
226 return get() < other.get();
263 template <
typename ValueType,
typename... Args>
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
TfDelegatedCountPtr & operator=(const TfDelegatedCountPtr &ptr) noexcept(IncrementAndDecrementAreNoExcept())
TfDelegatedCountPtr(const TfDelegatedCountPtr &ptr) noexcept(IncrementIsNoExcept())
std::integral_constant< bool, noexcept(TfDelegatedCountIncrement(std::declval< RawPtrType >()))> IncrementIsNoExcept
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)
GLsizei const GLfloat * value
bool operator!=(const TfDelegatedCountPtr< OtherType > &other) const noexcept
Returns false if the underlying pointers are equivalent.
TfDelegatedCountPtr(TfDelegatedCountPtr &&ptr) noexcept
void reset() noexcept(DecrementIsNoExcept())
bool operator==(const TfDelegatedCountPtr< OtherType > &other) const noexcept
Return true if the underlying pointers are equivalent.
std::integral_constant< bool, IncrementIsNoExcept()&&DecrementIsNoExcept()> IncrementAndDecrementAreNoExcept
std::integral_constant< bool, noexcept(*std::declval< RawPtrType >())> DereferenceIsNoExcept
TfDelegatedCountPtr() noexcept=default
Create a pointer storing nullptr
TfDelegatedCountPtr & operator=(const TfDelegatedCountPtr< OtherType > &ptr) noexcept(IncrementAndDecrementAreNoExcept())
RawPtrType get() const noexcept
Return the underlying pointer.
RawPtrType operator->() const noexcept
Arrow operator dispatch for the underlying pointer.
TfDelegatedCountPtr(TfDelegatedCountIncrementTagType, RawPtrType rawPointer) noexcept(IncrementIsNoExcept())
std::add_pointer_t< Sdf_Identity > RawPtrType
TfDelegatedCountPtr & operator=(std::nullptr_t) noexcept(DecrementIsNoExcept())
Reset this pointer to its default state (i.e. nullptr)
ReferenceType operator*() const noexcept(DereferenceIsNoExcept())
Dereference the underlying pointer.
TfDelegatedCountPtr< ValueType > TfMakeDelegatedCountPtr(Args &&...args)
void TfDelegatedCountDecrement(PXR_NS::Sdf_Identity *p) noexcept
constexpr struct TfDelegatedCountDoNotIncrementTagType TfDelegatedCountDoNotIncrementTag
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
**If you just want to fire and args
TfDelegatedCountPtr(const TfDelegatedCountPtr< OtherType > &ptr, std::enable_if_t< _IsPtrConvertible< OtherType >::value, int >=0) noexcept(IncrementIsNoExcept())
bool operator<(const TfDelegatedCountPtr< OtherType > &other) const noexcept
Orders based on the underlying pointer.
std::integral_constant< bool, noexcept(TfDelegatedCountDecrement(std::declval< RawPtrType >()))> DecrementIsNoExcept
PXR_NAMESPACE_OPEN_SCOPE constexpr struct TfDelegatedCountIncrementTagType TfDelegatedCountIncrementTag
TfDelegatedCountPtr & operator=(TfDelegatedCountPtr &&ptr) noexcept(DecrementIsNoExcept())
void TfDelegatedCountIncrement(PXR_NS::Sdf_Identity *p)
std::add_lvalue_reference_t< Sdf_Identity > ReferenceType
~TfDelegatedCountPtr() noexcept(DecrementIsNoExcept::value)
void swap(TfDelegatedCountPtr &other) noexcept
Swap this object's held pointer with other's.