88 static_assert(std::is_standard_layout<T>::value,
"HostDeviceVector admits only POD types");
102 bool Empty()
const {
return Size() == 0; }
104 int DeviceIdx()
const;
109 const T* ConstDevicePointer()
const;
110 const T* DevicePointer()
const {
return ConstDevicePointer(); }
112 T* HostPointer() {
return HostVector().data(); }
116 const T* ConstHostPointer()
const {
return ConstHostVector().data(); }
117 const T* HostPointer()
const {
return ConstHostPointer(); }
121 void Copy(
const std::vector<T>& other);
122 void Copy(std::initializer_list<T> other);
126 std::vector<T>& HostVector();
127 const std::vector<T>& ConstHostVector()
const;
128 const std::vector<T>& HostVector()
const {
return ConstHostVector(); }
130 bool HostCanRead()
const;
131 bool HostCanWrite()
const;
132 bool DeviceCanRead()
const;
133 bool DeviceCanWrite()
const;
136 void SetDevice(
int device)
const;
139 void Resize(
size_t new_size, T v = T());
141 using value_type = T;
Copyright 2014-2023, XGBoost Contributors.