Skip to content

Commit 0157ccd

Browse files
authored
Merge pull request ceph#62670 from adamemerson/wip-not-before-queue-signed-comparison
common/not_before_queue: Fix signed comparison warning Reviewed-by: Ronen Friedman <[email protected]>
2 parents 82febdb + fa71769 commit 0157ccd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/common/not_before_queue.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,20 @@ class not_before_queue_t {
131131

132132
template <typename U>
133133
bool operator()(const U &lhs, const container_t &rhs) const {
134-
return lhs < project_removal_class(rhs.v);
134+
if constexpr (std::is_integral_v<U>) {
135+
return std::cmp_less(lhs, project_removal_class(rhs.v));
136+
} else {
137+
return lhs < project_removal_class(rhs.v);
138+
}
135139
}
136140

137141
template <typename U>
138142
bool operator()(const container_t &lhs, const U &rhs) const {
139-
return project_removal_class(lhs.v) < rhs;
143+
if constexpr (std::is_integral_v<U>) {
144+
return std::cmp_less(project_removal_class(lhs.v), rhs);
145+
} else {
146+
return project_removal_class(lhs.v) < rhs;
147+
}
140148
}
141149
};
142150
struct removal_registry_disposer_t {

0 commit comments

Comments
 (0)