Avoid the use of size_t in the partitioner. (#10541)
- Avoid the use of size_t in the partitioner. - Use `Span` instead of `Elem` where `node_id` is not needed. - Remove the `const_cast`. - Make sure the constness is not removed in the `Elem` by making it reference only. size_t is implementation-defined, which causes issue when we want to pass pointer or span.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2020-2023 by XGBoost contributors
|
||||
* Copyright 2020-2024, XGBoost contributors
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -58,7 +58,7 @@ TEST(PartitionBuilder, BasicTest) {
|
||||
}
|
||||
builder.CalculateRowOffsets();
|
||||
|
||||
std::vector<size_t> v(*std::max_element(tasks.begin(), tasks.end()) * kBlockSize);
|
||||
std::vector<bst_idx_t> v(*std::max_element(tasks.begin(), tasks.end()) * kBlockSize);
|
||||
|
||||
for(size_t nid = 0; nid < kNodes; ++nid) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user