vault backup: 2023-03-20 12:19:51
This commit is contained in:
54
.obsidian/workspace.json
vendored
54
.obsidian/workspace.json
vendored
@@ -34,45 +34,9 @@
|
||||
},
|
||||
"pinned": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "0c4cc0216ea83049",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "04. Programming/Kotlin/AtomicBoolean.md",
|
||||
"mode": "source",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "6fe3a34cb01785c6",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "03. 專注Study/Android/Android programming.md",
|
||||
"mode": "source",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "02d3631a7d6b4afa",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "04. Programming/Kotlin/AtomicBoolean.md",
|
||||
"mode": "source",
|
||||
"source": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 4
|
||||
"currentTab": 1
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
@@ -130,7 +94,7 @@
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "04. Programming/Kotlin/AtomicBoolean.md",
|
||||
"file": "00. Inbox/01. TODO.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
@@ -166,7 +130,7 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "04. Programming/Kotlin/AtomicBoolean.md"
|
||||
"file": "00. Inbox/01. TODO.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,22 +156,23 @@
|
||||
"periodic-notes:Open today": false
|
||||
}
|
||||
},
|
||||
"active": "02d3631a7d6b4afa",
|
||||
"active": "3b4577823cedf427",
|
||||
"lastOpenFiles": [
|
||||
"03. 專注Study/Android/MediaCodec.md",
|
||||
"04. Programming/Kotlin/AtomicBoolean.md",
|
||||
"03. 專注Study/Android/Android programming.md",
|
||||
"01. 個人/00. Informations/Datas.md",
|
||||
"03. 專注Study/C++/C++20.md",
|
||||
"03. 專注Study/Android/MediaCodec.md",
|
||||
"03. 專注Study/Android/Android External Storage - Read, Write, Save File.md",
|
||||
"03. 專注Study/Android/ADB 取得 APK 的 icon.md",
|
||||
"attachments/android_mediacodec_life_cycle.png",
|
||||
"attachments/android_mediacodec_flow.png",
|
||||
"04. Programming/Kotlin/AtomicBoolean.md",
|
||||
"04. Programming/Kotlin/class.md",
|
||||
"04. Programming/Kotlin/`compareAndSet`.md",
|
||||
"00. Inbox/01. TODO.md",
|
||||
"04. Programming/Kotlin/run, let, with, also 和 apply.md",
|
||||
"05. 資料收集/軟體工具/git/tag.md",
|
||||
"05. 資料收集/讀書筆記/20230206 - 卡片盒筆記.md",
|
||||
"01. 個人/00. Informations/Datas.md",
|
||||
"03. 專注Study/Android/ADB.md",
|
||||
"02. 工作/01. Logitech/Sentinel.md",
|
||||
"02. 工作/01. Logitech/Tiny.md",
|
||||
@@ -224,7 +189,6 @@
|
||||
"01. 個人/01. Daily/2023/02",
|
||||
"02. 工作/01. Logitech/QA Sustaining Automation.md",
|
||||
"01. 個人/01. Daily/2023/02/2023-02-22(週三).md",
|
||||
"00. Inbox/Habit Tracker.md",
|
||||
"01. 個人/01. Daily/2023/02/2023-02-12(週日).md"
|
||||
"00. Inbox/Habit Tracker.md"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
# ME
|
||||
## 一般
|
||||
- [ ] 深入Android programming
|
||||
- 參考:[Modern Android App Development in 2023 | by Jorge Luis Castro Medina | Medium](https://devjorgecastro.medium.com/modern-android-app-development-in-2023-ff445d3652b4)
|
||||
- [ ] 課程:[Android Compose 教學課程 | Android Developers](https://developer.android.com/jetpack/compose/tutorial?hl=zh-tw)
|
||||
- [ ] [適用於 Android 開發人員的 Jetpack Compose | Android Developers](https://developer.android.com/courses/jetpack-compose/course?hl=zh-tw)
|
||||
- [ ] [Getting Started with CameraX](https://developer.android.com/codelabs/camerax-getting-started#1)
|
||||
- [ ] 想買定焦鏡
|
||||
- [ ] [XF18mmF2 R](https://www.fujifilm.com.tw/personal/digitalcamera/fujinon_lens_xf18mmf2_r/index.html)
|
||||
- 公司貨 $18000;[FUJINON XF18mm F2 R 鏡頭 - PChome 24h購物](https://24h.pchome.com.tw/prod/ABAQ07-A69947577)
|
||||
|
||||
97
03. 專注Study/C++/C++20.md
Normal file
97
03. 專注Study/C++/C++20.md
Normal file
@@ -0,0 +1,97 @@
|
||||
## Modules
|
||||
|
||||
Modules provide a new way to organize and manage large codebases, helping to improve build times, reduce code duplication, and increase modularity.
|
||||
```cpp
|
||||
// Example: math.cppm
|
||||
export module math;
|
||||
|
||||
export int square(int x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
export int cube(int x) {
|
||||
return x * x * x;
|
||||
}
|
||||
|
||||
// Example: main.cpp
|
||||
import math;
|
||||
|
||||
int main() {
|
||||
int result = math::square(5);
|
||||
// result = 25
|
||||
int result2 = math::cube(5);
|
||||
// result2 = 125
|
||||
}
|
||||
```
|
||||
|
||||
## Concepts
|
||||
|
||||
Concepts provide a way to specify **_constraints_** on templates, making it easier to write **_generic_** code that works with a wide range of types.
|
||||
```cpp
|
||||
template <typename T>
|
||||
concept Addable = requires(T a, T b) {
|
||||
{ a + b } -> T;
|
||||
};
|
||||
|
||||
template <Addable T>
|
||||
T add(T a, T b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int x = 1, y = 2;
|
||||
auto result = add(x, y);
|
||||
// result = 3
|
||||
}
|
||||
```
|
||||
|
||||
## Ranges
|
||||
|
||||
Ranges provide a new way to manipulate **_sequences_** of data in C++, making it easier to write clean, readable, and efficient code.
|
||||
```cpp
|
||||
#include <ranges>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::vector<int> v{1, 2, 3, 4, 5};
|
||||
auto even = v | std::ranges::views::filter([](int x) { return x % 2 == 0; });
|
||||
for (int x : even) {
|
||||
std::cout << x << '\n';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Contract Programming
|
||||
|
||||
Contract programming allows developers to specify **_preconditions_**, **_postconditions_**, and **_assertions_** in their code, making it easier to **catch** bugs early and reduce the number of runtime errors.
|
||||
```cpp
|
||||
#include <iostream>
|
||||
|
||||
[[nodiscard]] int foo() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int x = foo();
|
||||
std::cout << x << '\n';
|
||||
}
|
||||
```
|
||||
|
||||
## Improved Template Metaprogramming
|
||||
|
||||
C++20 includes several imrovements to the way templates can be used in C++, making it easier to write **generic** code that can be used with a wide range of types.
|
||||
|
||||
```cpp
|
||||
#include <type_traits>
|
||||
|
||||
template <typename T>
|
||||
struct is_integral : std::false_type {};
|
||||
|
||||
template <>
|
||||
struct is_integral<int> : std::true_type {};
|
||||
|
||||
int main() {
|
||||
static_assert(is_integral<int>::value, "");
|
||||
static_assert(!is_integral<float>::value, "");
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user