Is there a good template engine for C++
does anyone know of a good C++ template engine? Since, my aim is to try to generate C++ and Python code, given a template and a description of what needs to be filled in that template, in short, I'm trying to do something like cayenne but for C++ and Python, using a C++ processo开发者_Python百科r. Since it would be usefull for my other projects to automate the generation of persistence code.
Thanks in advance.
Have you had a look at Cheetah. We have been using Cheetah for a large Code generation project in QA and it has been working well for us.
Inja (https://github.com/pantor/inja) is a template engine for C++. It is header-only and quite simple, but works well for me.
Not sure of your precise requirements, but I've created a very lightweight templating engine at https://github.com/hughperkins/Jinja2CppLight
- handles variable substitution
- for loops
- including nested for loops
- very lightweight: no dependencies on qt, boost, etc ...
AtomWeaver is a target-agnostic generator: you can target any language or mix of languages in a single template. Template programming is done via Lua scripts though.
This generator implements a generative modeling approach (named ABSE): You can build a model by using small bits (the templates) and save it as a project. Then you can then evolve the model and/or the templates.
精彩评论