Clean up C++ warnings (#6213)

This commit is contained in:
Igor Moura
2020-10-19 12:02:33 -03:00
committed by GitHub
parent ddf37cca30
commit d1254808d5
20 changed files with 78 additions and 89 deletions

View File

@@ -43,7 +43,7 @@ class Column {
BinIdxType GetFeatureBinIdx(size_t idx) const { return index_[idx]; }
const uint32_t GetBaseIdx() const { return index_base_; }
uint32_t GetBaseIdx() const { return index_base_; }
common::Span<const BinIdxType> GetFeatureBinIdxPtr() const { return index_; }
@@ -179,12 +179,12 @@ class ColumnMatrix {
but for ColumnMatrix we still have a chance to reduce the memory consumption */
} else {
if (bins_type_size_ == kUint8BinsTypeSize) {
SetIndex<uint8_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint8_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
} else if (bins_type_size_ == kUint16BinsTypeSize) {
SetIndex<uint16_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint16_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
} else {
CHECK_EQ(bins_type_size_, kUint32BinsTypeSize);
SetIndex<uint32_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint32_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
}
}
}
@@ -271,7 +271,7 @@ class ColumnMatrix {
template<typename T>
inline void SetIndex(uint32_t* index, const GHistIndexMatrix& gmat,
const size_t nrow, const size_t nfeature) {
const size_t nfeature) {
std::vector<size_t> num_nonzeros;
num_nonzeros.resize(nfeature);
std::fill(num_nonzeros.begin(), num_nonzeros.end(), 0);
@@ -311,18 +311,18 @@ class ColumnMatrix {
rbegin += batch.Size();
}
}
const BinTypeSize GetTypeSize() const {
BinTypeSize GetTypeSize() const {
return bins_type_size_;
}
// This is just an utility function
const bool NoMissingValues(const size_t n_elements,
bool NoMissingValues(const size_t n_elements,
const size_t n_row, const size_t n_features) {
return n_elements == n_features * n_row;
}
// And this returns part of state
const bool AnyMissing() const {
bool AnyMissing() const {
return any_missing_;
}