From f7721562742607cb805eb4de27b9cdf3a9e32ebd Mon Sep 17 00:00:00 2001 From: Awin Huang Date: Sun, 12 Jun 2022 18:41:16 +0800 Subject: [PATCH] vault backup: 2022-06-12 18:41:15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Affected files: 02. PARA/03. Resources(資源)/C++17/lambda.md --- 02. PARA/03. Resources(資源)/C++17/lambda.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/02. PARA/03. Resources(資源)/C++17/lambda.md b/02. PARA/03. Resources(資源)/C++17/lambda.md index 9de7c16..ffae872 100644 --- a/02. PARA/03. Resources(資源)/C++17/lambda.md +++ b/02. PARA/03. Resources(資源)/C++17/lambda.md @@ -16,4 +16,11 @@ description: - 以中括號開頭,中括號被稱為*lamdba 導入器(lamdba introducer)* - 小括號裡面是*lamdba 參數列表(lambda parameter list)* - 如果沒有參數,小括號可以省略,`[] () {...}` 可以簡寫成 `[] {...}` -- 箭號(`->`)後面是回傳的型別,如果沒寫就由 `return` 自動推斷 \ No newline at end of file +- 箭號(`->`)後面是回傳的型別,如果沒寫就由 `return` 自動推斷 + +將 Lamdba 運算式指定給變數: +```cpp +auto comapre = [] (int x, int y) -> bool { + return x < y; +}; +``` \ No newline at end of file