Add a better cxx_gen function generator