Blog

Simulating Rust Trait in C++

I got in touch with rust quite early and watched its ecosystem gradually improve. When I first used trait, I wondered how to implement such a great feature in c++. Though it wasn’t an urgent need, I put it aside. Recently, I tried to implement it in a simple way. Rust Trait Let’s first look at an example of rust trait. Simply put, it’s about defining interfaces, implementing interfaces, and interface polymorphism. Actually, c++ already has a complete inheritance paradigm to implement these requirements - virtual interface, inheritance implementation, virtual polymorphism. However, virtual functions require forced dynamic dispatch and add virtual table pointers to class instances. So let’s try to implement trait without using virtual inheritance. ...

March 12, 2025 · 4 min · hypengw

Is Flatpak a Package Manager

Reading this article requires some understanding of: Linux distributions, Linux Desktop Environment, Package Manager My first encounter with Linux was in high school, when there seemed to be a software that only had a Linux version, so I tried to install Arch by following online articles. I don’t remember the specific details anymore. For me at that time, a bunch of incomprehensible commands were quite a headache, and I was always afraid of breaking my computer. ...

January 3, 2025 · 9 min · hypengw