Raw basic pattern implementations in c++