Clang/LLVM: clang -dM -E -x c /dev/nullclang++ -dM -E -x c++ /dev/null GNU GCC/G++: gcc -dM -E -x c /dev/nullg++ -dM -E -x c++ /dev/null Hewlett-Packard C/aC++: cc -dM -E -x c /dev/nullaCC -dM -E -x c++ /dev/null IBM XL C/C++: xlc -qshowmacros -E /dev/nullxlc++ -qshowmacros -E /dev/null Intel ICC/ICPC: […]
Category: c++
Access Private Members
Have you ever wondered if there is a standard conformant way to access a private member in C++. One could #define private publicor try to reinterpret_cast to a type with similar layout or violate the language in a similar way. So is there a better way to do it? The […]
Dispatch Functions Depending on their Return Values
Run Callable on each Argument
This snippet shows how to run a callable given as first argument on each following argument.
perf – linux performance
Recently I came along Brendan D. Gregg’s Homepage who is doing really awesome stuff to find performance bottlenecks. As it does not make sense to repeat everything here from perf_events, probes to flamegraphs. I really recommend to take a look at his work. Some Notes to myself: For stack traces […]
System Includes
If you have ever asked yourself how to avoid warnings in your c++ projects that are caused by 3rd-party projects like boost “system includes” are the answer. All you need to to is replace the -I flag with -isystem. Of course the CMake offers the same functionality you can use […]
create powerset of set given in a vector
Here is an algorithm that calculates the powerset of a set of elements given in a vector input of length n. A vector bit that will be used to select subsets is created and it’s elements are initialized with 1. Then for each subset size up to n/2 (outer loop) […]