15 explicit Predicate(
const std::function<
bool(
void)>& predicate_function) : predicate_(std::move(predicate_function)) {
16 previous_value_ = !predicate_();
19 bool get_value()
const {
return predicate_(); }
21 void set_predicate(
const std::function<
bool(
void)>& predicate_function) { predicate_ = predicate_function; }
23 std::optional<bool> query() {
24 if (
const auto new_value = predicate_(); new_value != previous_value_) {
25 previous_value_ = new_value;
32 std::function<bool(
void)> predicate_;