6 #ifndef XGBOOST_INTRUSIVE_PTR_H_ 
 7 #define XGBOOST_INTRUSIVE_PTR_H_ 
 22  std::atomic<int32_t> count_ {0};
 
 25  std::int32_t IncRef() noexcept {
 
 26  return count_.fetch_add(1, std::memory_order_relaxed);
 
 28  std::int32_t DecRef() noexcept {
 
 29  return count_.fetch_sub(1, std::memory_order_release);
 
 31  bool IsZero()
 const { 
return Count() == 0; }
 
 35  int32_t 
Count()
 const { 
return count_.load(std::memory_order_relaxed); }
 
 83  std::atomic_thread_fence(std::memory_order_acquire);
 
 96  return std::hash<element_type *>()(ptr.get());
 
 135  explicit operator bool() const noexcept { 
return static_cast<bool>(
ptr_); }
 
 149 template <
class T, 
class U>
 
 151  return x.get() == y.get();
 
 154 template <
class T, 
class U>
 
 156  return x.get() != y.get();
 
 159 template <
class T, 
class U>
 
 164 template <
class T, 
class U>
 
 169 template <
class T, 
class U>
 
 174 template <
class T, 
class U>
 
 181  return std::less<T*>{}(x.get(), y.get());
 
 186  return std::less_equal<T*>{}(x.get(), y.get());
 
 199 template <
class E, 
class T, 
class Y>
 
 200 std::basic_ostream<E, T> &
operator<<(std::basic_ostream<E, T> &os,
 
 201  IntrusivePtr<Y> 
const &p) {
 
 214 template <
typename T>
 
用于将引用计数嵌入客户端对象的辅助类。详见 https://www....
定义: intrusive_ptr.h:20
int32_t Count() const
定义: intrusive_ptr.h:35
IntrusivePtrCell() noexcept=default
侵入式指针的实现。一个指向带有嵌入式引用计数对象的智能指针。
定义: intrusive_ptr.h:73
IntrusivePtr< T > & operator=(IntrusivePtr< T > &&that) noexcept
定义: intrusive_ptr.h:120
element_type & operator*() const noexcept
定义: intrusive_ptr.h:131
void reset(element_type *that)
定义: intrusive_ptr.h:129
IntrusivePtr< T > & operator=(IntrusivePtr< T > const &that)
定义: intrusive_ptr.h:116
IntrusivePtr(IntrusivePtr &&that) noexcept
定义: intrusive_ptr.h:112
void swap(IntrusivePtr< T > &that) noexcept
定义: intrusive_ptr.h:144
element_type * get() const noexcept
定义: intrusive_ptr.h:133
~IntrusivePtr()
定义: intrusive_ptr.h:114
IntrusivePtr() noexcept=default
T * ptr_
定义: intrusive_ptr.h:90
T element_type
定义: intrusive_ptr.h:93
int32_t use_count() noexcept
定义: intrusive_ptr.h:137
IntrusivePtr(T *p)
从原始指针构造IntrusivePtr。IntrusivePtr拥有所有权。
定义: intrusive_ptr.h:104
element_type * operator->() const noexcept
定义: intrusive_ptr.h:132
void reset()
定义: intrusive_ptr.h:125
Definition: intrusive_ptr.h:207
void swap(xgboost::IntrusivePtr< T > &x, xgboost::IntrusivePtr< T > &y) noexcept
定义: intrusive_ptr.h:209
集成目标、gbm和评估的学习器接口。这是用户面临的XGB...
Definition: base.h:97
bool operator!=(IntrusivePtr< T > const &x, IntrusivePtr< U > const &y) noexcept
定义: intrusive_ptr.h:155
bool operator==(IntrusivePtr< T > const &x, IntrusivePtr< U > const &y) noexcept
定义: intrusive_ptr.h:150
IntrusivePtrCell & IntrusivePtrRefCount(T const *ptr) noexcept
用于返回嵌入式引用计数的自定义函数。
std::ostream & operator<<(std::ostream &os, DeviceOrd ord)
bool operator>=(IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
定义: intrusive_ptr.h:195
bool operator>(IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
定义: intrusive_ptr.h:190
bool operator<=(IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
定义: intrusive_ptr.h:185
bool operator<(IntrusivePtr< T > const &x, IntrusivePtr< T > const &y) noexcept
定义: intrusive_ptr.h:180
std::size_t operator()(IntrusivePtr< element_type > const &ptr) const noexcept
定义: intrusive_ptr.h:95