diff --git a/02. PARA/03. Resources(資源)/C++17/lambda.md b/02. PARA/03. Resources(資源)/C++17/lambda.md index ffae872..6598a50 100644 --- a/02. PARA/03. Resources(資源)/C++17/lambda.md +++ b/02. PARA/03. Resources(資源)/C++17/lambda.md @@ -23,4 +23,14 @@ description: auto comapre = [] (int x, int y) -> bool { return x < y; }; -``` \ No newline at end of file +``` + +## Lamdba的擷取子句 +以中括號開頭的 *lamdba 導入器*可以將外部的變數傳給 Lamdba 運算式,正式名稱是「擷取子句(capture clause)」。 +[=] 表示它們會以值擷取(captured by value)。 +[&] 表示它們會以址擷取(captured by reference)。 + +### 以值擷取(captured by value) +假設有一個function如下: + +### 以址擷取(captured by reference) \ No newline at end of file