What’s the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?

[*] A ClusterIP exposes the following: spec.clusterIp:spec.ports[*].port You can only access this service while inside the cluster. It is accessible from its spec.clusterIp port. If a spec.ports[*].targetPort is set it will route from the port to the targetPort. The CLUSTER-IP you get when calling kubectl get services is the IP assigned to this service within … Read more

Heterogeneous containers in C++

Well generally C++ Containers are designed to hold objects of a single type using templates. If you want different types that are all derived from one type you can store a container of pointers (I guess you could also have a container of void* to anything…) e.g. std::vector<MyBaseType*>. If you want completely unrelated types, you … Read more

What’s the best way to iterate over two or more containers simultaneously

Rather late to the party. But: I would iterate over indices. But not with the classical for loop but instead with a range-based for loop over the indices: for(unsigned i : indices(containerA)) { containerA[i] = containerB[i]; } indices is a simple wrapper function which returns a (lazily evaluated) range for the indices. Since the implementation … Read more

Why isn’t vector a STL container?

For space-optimization reasons, the C++ standard (as far back as C++98) explicitly calls out vector<bool> as a special standard container where each bool uses only one bit of space rather than one byte as a normal bool would (implementing a kind of “dynamic bitset”). In exchange for this optimization it doesn’t offer all the capabilities … Read more