vault backup: 2022-07-13 10:53:13

Affected files:
.obsidian/workspace
02. PARA/03. Resources(資源)/C++17/for_each.md
This commit is contained in:
2022-07-13 10:53:13 +08:00
parent 70dfe34415
commit 170066d854
2 changed files with 18 additions and 5 deletions

8
.obsidian/workspace vendored
View File

@@ -9,7 +9,7 @@
"state": {
"type": "markdown",
"state": {
"file": "02. PARA/01. Project專案/008. Sentinel.md",
"file": "02. PARA/03. Resources資源/C++17/for_each.md",
"mode": "source",
"source": true
}
@@ -69,7 +69,7 @@
"state": {
"type": "backlink",
"state": {
"file": "02. PARA/01. Project專案/008. Sentinel.md",
"file": "02. PARA/03. Resources資源/C++17/for_each.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@@ -86,7 +86,7 @@
"state": {
"type": "outline",
"state": {
"file": "02. PARA/01. Project專案/008. Sentinel.md"
"file": "02. PARA/03. Resources資源/C++17/for_each.md"
}
}
}
@@ -116,11 +116,11 @@
},
"active": "ec13ce58b15fa6d4",
"lastOpenFiles": [
"02. PARA/01. Project專案/008. Sentinel.md",
"02. PARA/03. Resources資源/C++17/for_each.md",
"02. PARA/03. Resources資源/讀書筆記/20220619 - 精確的力量.md",
"02. PARA/03. Resources資源/C++17/智慧指標.md",
"02. PARA/03. Resources資源/C++17/C++17.md",
"02. PARA/01. Project專案/008. Sentinel.md",
"00. TOP/01. TODO.md",
"02. PARA/02. Area領域/20150803 - Android/ADB 取得 APK 的 icon.md",
"02. PARA/02. Area領域/20150803 - Android/ADB.md",

View File

@@ -8,4 +8,17 @@ template<class InputIterator, class Function>
);
```
它需要3個參數第1個是開始的iterator第2是結束的 iterator第3個是要用來處理的 function
它需要3個參數第1個是開始的iterator第2是結束的 iterator第3個是要用來處理的 function
一個簡單的例子有一個array需要把每一個數都加1
```cpp
vector<int> arr1 = { 4, 5, 8, 3, 1 };
for_each(
arr1.begin(), // _Start
arr1.end(), // _Last
[](int& val) { // _Func
val += 1;
}
);
```