From c05c7e6cc1e2be168c4c732a53f95d9172e47ab0 Mon Sep 17 00:00:00 2001 From: Laurent <102887709+LaurentZC@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:08:29 +0800 Subject: [PATCH] Update design_virtual.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fetch()返回optional,用 int 接受了,改为了 auto 接收 --- docs/design_virtual.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/design_virtual.md b/docs/design_virtual.md index c89c802..449945c 100644 --- a/docs/design_virtual.md +++ b/docs/design_virtual.md @@ -298,8 +298,8 @@ struct Inputer { int reduce(Inputer *inputer, Reducer *reducer) { int res = reducer->init(); - while (int tmp = inputer->fetch()) { - res = reducer->add(res, tmp); + while (auto tmp = inputer->fetch()) { + res = reducer->add(res, tmp.value()); } return res; } @@ -354,8 +354,8 @@ Inputer 负责告诉 reduce 函数如何读取数据,Reducer 负责告诉 redu ```cpp int reduce(Reducer *reducer) { int res = reducer->init(); - while (int tmp = reducer->fetch()) { // fetch 凭什么和 init、add 放在一起? - res = reducer->add(res, tmp); + while (auto tmp = reducer->fetch()) { // fetch 凭什么和 init、add 放在一起? + res = reducer->add(res, tmp.value()); } return res; }