-
Pythonic Operators on STL Set Algorithms
Table of Contents Introduction Set Intersection Set Union Set Difference Set Symmetric Difference Superset and Subset “I have no use for all these!” Introduction Ever since I started working with Python and that have gotten me into alot thinking how to redesign my libraries to be pythonic, if I were to implement them from […]
-
C++ Summing For Loop Benchmark
Introduction The initial motivation is to find out the overhead of different for-loop types in C++. Code Copy and paste below code into Godbolt Online C++ Compiler to see the generated assembly code. Note: The array or vector are initialized in the benchmark. The simplified code below is for you to copy and paste […]
-
C++ Tip: Modification Inside const Function
Introduction There are times where modification inside const member function must be done (for example, to allow for caching or memoization). The mutable keyword and const_cast are well-known in the C++ circles to work around these. The 3rd way is to use a const pointer; we cannot modify the const pointer but we can […]
-
C++ Tip: Make Your Class Non-Copyable Without Boost
Introduction There are times where an object should never be passed by copy but by reference or pointer. For instance, the class has a data member (like counter or mutex) which should not be duplicated. In this tip, we take a look at 2 techniques which declare the class to be non-copyable without resorting to using […]