软件简介

cpptempl 是一个 C++ 模板引擎。

语法:

模板流

  • Variables

{$variable}
  • Loops:

{% for person in people %}Name: {$person.name}{% endfor %}
  • If:

{% if person.name == "xu" %}Full name: xu{% endif %}

使用:

cpptempl::auto_data data;
data["age"] = 10;
data["name"] = "xu";
std::string str = "name:{$name}, age:{$age}";
std::string ret = cpptempl::parse(str, data);  // ret will be "name:xu, age:10"


转载自: https://www.oschina.net/p/cpptempl