C++ declaration
Structured Binding Structured binding dcl.struct.bind is easy to use but has many pitfalls if you zoom in on the details. The first question is what types do the binding variables have. Let’s take...
Structured Binding Structured binding dcl.struct.bind is easy to use but has many pitfalls if you zoom in on the details. The first question is what types do the binding variables have. Let’s take...
client-go is the Go client for Kubernetes. Authentication I use EKS at work. Below is the section of my ./kube/config file, - name: arn:aws:eks:us-east-2:597088060484:cluster/staging user: ...
weakref.ref and weakref.ReferenceType are the same thing. See code. The __call__ is implemented here.
priority queue Constructor Priority queue has signature std::priority_queue<T,Container=vector,Compare=std::less> , so you can see that comparator class is provided as a template parameter....
pop_front Below code has a bug auto& element = que.pop_front() According to the standard, reference to the popped element will be invalidated, so we should create a copy instead of referenc...
Various components inside header <functional>. std::less and std::greater These are two structs with trivial implementation of operator(). It relies on the value type to implement operator&...
One lesson I learnt from reading std::variant implementation is that union in C++ can have complicated structure. Before, I thought we should only use union in this way: union U { int a; c...
I got quite confused the first time I read vector implementation. After a few minutes’ struggle, I realized that there are two implementations: the general vector and the specialized vector<boo&...
std::unordered_set Both unordered_set and unordered_map use an internal __hash_table object, so it suffices to only talk about how hash table works in C++. The basic structure looks like diagram ...
I use SSH almost every work day, but never thought about how it works exactly until one day I got an error message Permission denied (publickey) when trying to git clone a repo. This post documents...