cemplate

Simple C++ template engine
git clone git://git.dimitrijedobrota.com/cemplate.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |

example.cpp (936B)


1 #include <iostream> 2 3 #include "cemplate/cemplate.hpp" 4 5 int main() 6 { 7 using namespace std::string_literals; // NOLINT 8 using namespace cemplate; // NOLINT 9 10 std::cout << Pragma("once") << '\n'; 11 12 std::cout << Include("format"); 13 std::cout << Include("iostream"); 14 std::cout << Include("string"); 15 std::cout << '\n'; 16 17 std::cout << Namespace("cemplate"); 18 19 std::cout << Function("test", "int"); 20 std::cout << Return("3"); 21 std::cout << Function("test"); 22 23 std::cout << Function("test", "void", {{{"int"s, "val1"s}}}); 24 std::cout << Function("test"); 25 26 std::cout << Function( 27 "test", "void", {{"int"s, "val1"s}, {"std::string"s, "val2"s}}); 28 std::cout << Function("test"); 29 30 std::cout << FunctionD("decl", "void"); 31 std::cout << '\n'; 32 33 std::cout << "static const test_class test = "; 34 std::cout << Initlist({"val11", "val12", {"val21", "val22"}, "val13"}); 35 36 std::cout << Namespace("cemplate"); 37 38 return 0; 39 }