diff --git a/include/opendht/value.h b/include/opendht/value.h index a74f93a0..4d55984e 100644 --- a/include/opendht/value.h +++ b/include/opendht/value.h @@ -146,9 +146,18 @@ struct Value return true; }; } + static Filter chainOr(Filter&& f1, Filter&& f2) { + if (not f1 or not f2) return AllFilter(); + return [f1,f2](const Value& v) { + 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() {