有没有一个好的 C++ 模板引擎?
有谁知道一个好的 C++ 模板引擎吗?因为,我的目标是尝试生成 C++ 和 Python 代码,给定一个模板和需要在该模板中填写的内容的描述,简而言之,我正在尝试做类似辣椒的事情,但对于 C++ 和 Python,使用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++ processor. Since it would be usefull for my other projects to automate the generation of persistence code.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您看过Cheetah吗?我们一直在 QA 中使用 Cheetah 进行大型代码生成项目,它对我们来说效果很好。
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) 是 C++ 的模板引擎。它只有标题并且非常简单,但对我来说效果很好。
Inja (https://github.com/pantor/inja) is a template engine for C++. It is header-only and quite simple, but works well for me.
不确定您的确切要求,但我在 https://github.com/hughperkins 创建了一个非常轻量级的模板引擎/Jinja2CppLight
Not sure of your precise requirements, but I've created a very lightweight templating engine at https://github.com/hughperkins/Jinja2CppLight
AtomWeaver 是一个与目标无关的生成器:您可以在单个模板中定位任何语言或多种语言。模板编程是通过 Lua 脚本完成的。
该生成器实现了生成建模方法(名为 ABSE):您可以使用小位(模板)构建模型并将其另存为项目。然后您可以改进模型和/或模板。
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.