- Here is a personal programming-related blog.
- Want to know about me?
- To contact me, use one of the methods below.
C++: How to Access Private Members VALIDLY
Intro In most contexts, private members are forbidden to access outside its class. But as the title says, I’ll show you a way to validly access them. Valid, here, I mean it’s well-defined according to the standard, and not causing undefined behavior. This post is inspired by a post more than 10 years ago. It introduces this technique but doesn’t explain why. What does the standard say? There’re two places where private are allowed to be used outside its enclosing class,...
C++: Elegant Ways to Map Runtime Values to Types
This post introduces two elegant ways to dispatch based on runtime values.
Algorithms behind Popcount
Three algorithms of popcount.
C++ Virtual Table Tables(VTT)
It’s a detailed explanation about virtual table tables(VTT) in C++.
What does C++ Object Layout Look Like?
Explain the object memory layout of C++ based on Itanium ABI specification.
A Subtle Bug Before C++17
This post will show you a subtle performance bug due to unsupport for over-aligned types before C++17.
Iyengar111 NanoLog Source Code Reading
Overview Iyengar111/NanoLog is a fast and lightweight C++11 logging library. It has only less than a thousand lines of code. It’s less famous than another eponymous version, and this repo seems not under maintenance any longer. I read the source code for learning. This post delves into its technique details. Usage #include "NanoLog.hpp" int main() { nanolog::initialize(nanolog::GuaranteedLogger(), "/tmp/", "nanolog", 1); // nanolog::initialize(nanolog::NonGuaranteedLogger(3), "/tmp/", "nanolog", 1); LOG_INFO << "this is " << 42; return 0; } There are two modes to set when initializing....
Glog Source Code Reading Notes
A note for reading the source code of glog
How to Return Values Effectively in C++
This post will tell you the practices for returning values in Modern C++