C++ variant of 006