Blog

Mostly technical writing, with a few career posts and other things I ended up caring enough to write down.

Filtered by tag:C++·9 postsClear ×

C++ 多型:靜態(template) vs 動態(virtual)

2026-06-16

同一介面、不同行為,C++ 有兩條路:動態多型(virtual,執行期分派)與靜態多型(template / CRTP,編譯期分派)。以例子對照,附 concept 與選用時機。

C++Performance

C++ 反射入門

2026-06-16

反射就是程式檢視自己的型別與結構。C++ 一直做得克難:執行期靠 RTTI、編譯期靠 type_traits,要列欄位得靠第三方庫,而 C++26 的 static reflection 把它變成語言內建。搭配簡單例子,順便對照其他語言。

C++Reflection

C++20 的 std::span 應用整理

2026-06-10

std::span 把 vector、array、指標加長度收成同一個介面:基本用法、subspan 切片、static extent,還有 span<const T> 跟 const span<T> 不是同一回事的坑。

C++C++20

C++20 的 std::format 語法整理

2026-05-26

std::format 格式語法速記:對齊寬度、浮點數的 precision 與 type,還有 precision 在浮點數跟字串上語義不同的坑。

C++C++20

C++ 編譯期可以做的五件事

2026-03-31

從 constexpr 到 LUT 生成 - 五個實用的編譯期技巧,把能在編譯期做的事移到編譯期。

C++Performance

SSO 跟 Copy Elision:編譯器與標準庫做的事

2026-03-31

std::string 不一定用 heap?return 時加 std::move 反而更慢?拆解編譯器與標準庫在背後做的事。

C++PerformanceMemory

Padding、Vtable、Smart Pointer 的成本

2026-03-31

sizeof 不是你想的那樣、virtual 讓物件膨脹 4 倍、shared_ptr 的隱藏原子操作代價。

C++PerformanceMemory

手寫 inplace_vector(C++ 面試題)

2026-03-31

世界頂級量化交易公司的面試,面試官劍橋畢業,從零實作 inplace_vector:aligned storage、placement new、Rule of Five。

C++C++26Interview

HFT 面試的六道 C++ 效能題

2026-03-31

我親身參與的某知名 Crypto / HFT 公司 C++ 面試,涵蓋 string 傳遞、lambda 捕獲、Order Book 設計等六道效能分析題。

C++InterviewHFT