C++ string template library

后端 未结 10 1118
清酒与你
清酒与你 2020-12-16 01:23

I want simple C++ string based template library to replace strings at runtime.

For example, I will use

string template = \"My name is {{name}}\";
         


        
10条回答
  •  无人及你
    2020-12-16 02:12

    You can have a look at Inja. It is a simple, header-only template engine and does what you're asking for. There you can just call

    data["name"] = "world";
    inja::render("Hello {{ name }}!", data); // Returns "Hello world!"
    

提交回复
热议问题