Are there any issues which might make MS's T4 Template code-generation system unsuitable for generating C++ code?
It can generate any text you want, including C++ code.