mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
fix wrong std::move in Value::Filter::chain
Also, instance calls to Value::Filter::chain methods were moving the calling instance while you may not want this in many cases.
This commit is contained in:
1 parent
92613f5fbf
commit
98a3960bf8
1 file changed
+8
-6
@@ -130,6 +130,14 @@ struct Value
|
||||
class Filter : public std::function<bool(const Value&)> {
|
||||
using std::function<bool(const Value&)>::function;
|
||||
public:
|
||||
Filter chain(Filter&& f2) {
|
||||
auto f1 = *this;
|
||||
return chain(std::move(f1), std::move(f2));
|
||||
}
|
||||
Filter chainOr(Filter&& f2) {
|
||||
auto f1 = *this;
|
||||
return chainOr(std::move(f1), std::move(f2));
|
||||
}
|
||||
static Filter chain(Filter&& f1, Filter&& f2) {
|
||||
if (not f1) return f2;
|
||||
if (not f2) return f1;
|
||||
@@ -152,12 +160,6 @@ struct Value
|
||||
return f1(v) or f2(v);
|
||||
};
|
||||
}
|
||||
Filter chain(Filter&& f2) {
|
||||
return chain(std::move(*this), std::move(f2));
|
||||
}
|
||||
Filter chainOr(Filter&& f2) {
|
||||
return chainOr(std::move(*this), std::move(f2));
|
||||
}
|
||||
};
|
||||
|
||||
static const Filter AllFilter() {
|
||||
|
||||
Reference in new issue
Block a user