Small cleanups to various data types. (#8086)

- Use `bst_bin_t` in batch param constructor.
- Use `StringView` to avoid `std::string` when appropriate.
- Avoid using `MetaInfo` in quantile constructor to limit the scope of parameter.
This commit is contained in:
Jiaming Yuan
2022-07-18 22:39:36 +08:00
committed by GitHub
parent e28f6f6657
commit 4083440690
9 changed files with 52 additions and 53 deletions

View File

@@ -1137,16 +1137,15 @@ class SparsePageAdapterBatch {
public:
struct Line {
SparsePage::Inst inst;
Entry const* inst;
size_t n;
bst_row_t ridx;
COOTuple GetElement(size_t idx) const {
return COOTuple{ridx, inst.data()[idx].index, inst.data()[idx].fvalue};
}
size_t Size() const { return inst.size(); }
COOTuple GetElement(size_t idx) const { return {ridx, inst[idx].index, inst[idx].fvalue}; }
size_t Size() const { return n; }
};
explicit SparsePageAdapterBatch(HostSparsePageView page) : page_{std::move(page)} {}
Line GetLine(size_t ridx) const { return Line{page_[ridx], ridx}; }
Line GetLine(size_t ridx) const { return Line{page_[ridx].data(), page_[ridx].size(), ridx}; }
size_t Size() const { return page_.Size(); }
};
}; // namespace data