diff --git a/include/xgboost/host_device_vector.h b/include/xgboost/host_device_vector.h index c4d12da53079..36c7ed32b83d 100644 --- a/include/xgboost/host_device_vector.h +++ b/include/xgboost/host_device_vector.h @@ -137,7 +137,7 @@ class HostDeviceVector { void Resize(std::size_t new_size); /** @brief Resize and initialize the data if the new size is larger than the old size. */ - void Resize(size_t new_size, T v); + void Resize(std::size_t new_size, T v); using value_type = T; // NOLINT diff --git a/src/common/host_device_vector.cu b/src/common/host_device_vector.cu index 967af9a632ca..16a1aa027f09 100644 --- a/src/common/host_device_vector.cu +++ b/src/common/host_device_vector.cu @@ -129,7 +129,7 @@ class HostDeviceVectorImpl { void Extend(HostDeviceVectorImpl* other) { auto ori_size = this->Size(); - this->Resize(ori_size + other->Size(), T()); + this->Resize(ori_size + other->Size(), T{}); if (HostCanWrite() && other->HostCanRead()) { auto& h_vec = this->HostVector(); auto& other_vec = other->HostVector(); @@ -172,7 +172,7 @@ class HostDeviceVectorImpl { } template - auto ResizeImpl(std::size_t new_size, U&&... args) { + auto Resize(std::size_t new_size, U&&... args) { if (new_size == Size()) { return; } @@ -190,9 +190,6 @@ class HostDeviceVectorImpl { } } - void Resize(std::size_t new_size, T v) { this->ResizeImpl(new_size, v); } - void Resize(std::size_t new_size) { this->ResizeImpl(new_size); } - void LazySyncHost(GPUAccess access) { if (HostCanAccess(access)) { return; } if (HostCanRead()) { @@ -410,7 +407,7 @@ void HostDeviceVector::Resize(std::size_t new_size) { } template -void HostDeviceVector::Resize(size_t new_size, T v) { +void HostDeviceVector::Resize(std::size_t new_size, T v) { impl_->Resize(new_size, v); }