Common Cpp Algorithms for reuse