Skip to content

Commit

Permalink
Add missing xgboost::common::WQSummary::Entry::operator==
Browse files Browse the repository at this point in the history
Thrust fails to compile with specific combinations of NVCC and GCC from
an undefined == operator.
  • Loading branch information
chuckatkins committed Sep 3, 2024
1 parent f52f11e commit e7e1abe
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/common/quantile.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <cstring>
#include <iostream>
#include <set>
#if __cplusplus < 202002L
#include <tuple> // WQSummary::Entry::operator==
#endif
#include <vector>

#include "categorical.h"
Expand Down Expand Up @@ -71,6 +74,15 @@ struct WQSummary {
<< "value: " << e.value;
return os;
}

#if __cplusplus < 202002L
#include <tuple>
// Default comparison operators aren't present until C++20
inline bool operator==(const Entry &rhs) const {
return std::tie(rmin, rmax, wmin, value) ==
std::tie(rhs.rmin, rhs.rmax, rhs.wmin, rhs.value);
}
#endif
};
/*! \brief input data queue before entering the summary */
struct Queue {
Expand Down

0 comments on commit e7e1abe

Please sign in to comment.