C/C++ (2)

Properties in C++20

Austin Hanson Austin Hanson C/C++

C++ doesn't support getter/setter style properties. But you can get pretty darn close with templates or macros. #include <iostream> #include "properties.h" using namespace std; class User { private: int mId; int mWeight; int mPurse; int mBank; public: // Non-auto property only supporting get (runtime check) Property<int> Id{{ .get = mId…

Page Up & Page Down with Kilo Editor

Austin Hanson Austin Hanson C/C++

I've recently started going through this brilliant article on creating your own text editor (read: nano/pico clone). If you've never built one this article breaks it down into easy to follow chunks. If you do go through it, you might notice the same thing I did. Page Up and Page…