Generic Base2/16/32/64 Encoding Algorithms for C++