全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Lambda expression, capture?

又称: lambda expression · capture (lambda)

Definition 5.6 University Computer Science — Year 2 · 第 5 章 — The Standard Library: Containers, Iterators and Algorithms

A lambda expression [captures](parameters) { body } creates an unnamed function object, an object of a class generated by the compiler whose operator() runs the body. Its captures list the local variables of the enclosing function the body uses: [x] stores a copy of x in the object, [&x] a reference to it, [=] and [&] capture every variable the body uses, by copy or by reference.

在原文中阅读 →