labels: ensure c++17 compatibility
This broke the build earlier.
This commit is contained in:
@ -99,6 +99,12 @@ Mu::Labels::parse_delta_label(const std::string &expr)
|
|||||||
return Ok(DeltaLabel{std::move(delta), std::move(label)});
|
return Ok(DeltaLabel{std::move(delta), std::move(label)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct cmp_delta_label { // can not yet be a λ in C++17
|
||||||
|
bool operator()(const DeltaLabel& dl1, const DeltaLabel& dl2) const {
|
||||||
|
return dl1.second < dl2.second;
|
||||||
|
}
|
||||||
|
};
|
||||||
std::pair<LabelVec, DeltaLabelVec>
|
std::pair<LabelVec, DeltaLabelVec>
|
||||||
Mu::Labels::updated_labels(const LabelVec& labels, const DeltaLabelVec& deltas)
|
Mu::Labels::updated_labels(const LabelVec& labels, const DeltaLabelVec& deltas)
|
||||||
{
|
{
|
||||||
@ -108,11 +114,9 @@ Mu::Labels::updated_labels(const LabelVec& labels, const DeltaLabelVec& deltas)
|
|||||||
// comparison operator so "add" and "remove" deltas are considered "the same"
|
// comparison operator so "add" and "remove" deltas are considered "the same"
|
||||||
// for the set; then fill the set from the end of the deltas vec to the begining,
|
// for the set; then fill the set from the end of the deltas vec to the begining,
|
||||||
// so "the last one wins", as we want.
|
// so "the last one wins", as we want.
|
||||||
const auto cmp_delta_label=[](const DeltaLabel& dl1, const DeltaLabel& dl2) {
|
|
||||||
return dl1.second < dl2.second;
|
|
||||||
};
|
|
||||||
// only one change per label, last one wins
|
// only one change per label, last one wins
|
||||||
std::set<DeltaLabel, decltype(cmp_delta_label)> working_deltas{
|
std::set<DeltaLabel, cmp_delta_label> working_deltas{
|
||||||
deltas.rbegin(), deltas.rend()
|
deltas.rbegin(), deltas.rend()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -216,7 +216,8 @@ import_labels_for_message(Mu::Store& store, const Options& opts,
|
|||||||
[](const auto& label) {
|
[](const auto& label) {
|
||||||
return DeltaLabel{Delta::Add, label}; });
|
return DeltaLabel{Delta::Add, label}; });
|
||||||
|
|
||||||
const auto qres = [&]->Result<QueryResults>{
|
const auto qres = [&]()
|
||||||
|
->Result<QueryResults>{
|
||||||
// plan A: match by path
|
// plan A: match by path
|
||||||
if (auto qres_a{log_import_get_matching(store, "path:" + path)}; !qres_a) {
|
if (auto qres_a{log_import_get_matching(store, "path:" + path)}; !qres_a) {
|
||||||
log_import_err(opts, mu_format("failed to find by path: {}; try with message-id",
|
log_import_err(opts, mu_format("failed to find by path: {}; try with message-id",
|
||||||
|
|||||||
Reference in New Issue
Block a user