cemplateSimple C++ template engine |
git clone git://git.dimitrijedobrota.com/cemplate.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
commit | f63cf5a4a08eb6a1c9c106a0629d390d80ec5794 |
parent | cbe018c7ee9d7f35785c76694c55cf47ac288011 |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Tue, 11 Mar 2025 19:22:51 +0100 |
Force left to right order of evaluation
Diffstat:M | example/example.cpp | | | ++-- |
M | include/cemplate/cemplate.hpp | | | +++--- |
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/example/example.cpp b/example/example.cpp
@@ -9,7 +9,7 @@ int main()
// clang-format off
// NOLINTBEGIN
program(std::cout,
program(std::cout, {
Pragma("once"),
empty(),
Include("format"),
@@ -38,7 +38,7 @@ int main()
Initlist({"val11", "val12", {"val21", "val22"}, "val13"}),
Namespace("cemplate")
);
});
// NOLINTEND
// clang-format on
diff --git a/include/cemplate/cemplate.hpp b/include/cemplate/cemplate.hpp
@@ -41,10 +41,10 @@ std::string join(InputIt first,
return res;
}
template<typename... Args>
void program(std::ostream& ost, const Args&... args)
inline void program(std::ostream& ost, std::initializer_list<std::string> args)
{
((ost << to_string()(args)), ...);
std::for_each(
std::begin(args), std::end(args), [&](const auto& val) { ost << val; });
}
inline const char* empty()