In need of a lightweight C++ Template Engine

David picture David · Jun 15, 2012 · Viewed 10k times · Source

I am in need of a very lightweight, fast, C++ template engine. I have been testing CTemplate and it fits my needs, yet it is a little slow. I have checked out many of the other template engines that have been recommended on this site, but most of them are more complex that CTemplate, and I am looking for the opposite. All I really need is simple text substitution, yet would prefer to use an existing engine. I also need a relaxed license, preferably MIT or BSD.

EDIT: Have looked into the following: ClearSilver, Teng, Templatizer, CTPP (This is a little complex to me... I pretty new to C++ and the linux dev environment) qctemplate, and more, just have to try and remember them

Answer

Hugh Perkins picture Hugh Perkins · Feb 20, 2015

Created one, since I too dislike having boost as a dependency :-)

https://github.com/hughperkins/Jinja2CppLight

  • uses Jinja2 syntax
  • supports variable substitution, and for loop
  • can be nested for-loops :-)
  • zero dependencies, just c++ and standard libraries :-)