cpp语法中[=]的定义

时间:2018-12-26 16:17:40

标签: c++

我正在查看android的源代码,并遇到了以下代码:

unique_fd local_end(sfd[0]);
unique_fd remote_end(sfd[1]);
sfd[0] = sfd[1] = -1;

// dump blocks until completion, so spawn a thread..
std::thread dump_thread([=, remote_end { std::move(remote_end) }]() mutable {
           int err = service->dump(remote_end.get(), args);

           // It'd be nice to be able to close the remote end of the socketpair before the dump
           // call returns, to terminate our reads if the other end closes their copy of the
          // file descriptor, but then hangs for some reason. There doesn't seem to be a good
          // way to do this, though.
          remote_end.reset();

          if (err != 0) {
              aerr << "Error dumping service info: (" << strerror(err) << ") " << service_name << endl;
          }
});

现在,我不明白这部分是什么意思:

[=, remote_end { std::move(remote_end) }]

有人可以解释一下吗?

0 个答案:

没有答案