hemplate

Simple XML template engine
git clone git://git.dimitrijedobrota.com/hemplate.git
Log | Files | Refs | README | LICENSE

commit 98d956c2a2f6c96dff5b0aa4f0c7934ed57c9bb6
parent cc19eac108e768124b0b4953fa9e2bef3dde7bf9
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon, 24 Jun 2024 20:22:46 +0200

Add variadic constructor to elementList

Diffstat:
MCMakeLists.txt | 2+-
Minclude/hemplate/element.hpp | 7+++++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -4,7 +4,7 @@ include(cmake/prelude.cmake) project( hemplate - VERSION 0.1.6 + VERSION 0.1.7 DESCRIPTION "Simple HTML template engine" HOMEPAGE_URL "https://git.dimitrijedobrota.com/hemplate.git" LANGUAGES CXX diff --git a/include/hemplate/element.hpp b/include/hemplate/element.hpp @@ -20,6 +20,13 @@ public: elementList(elementList&&) = default; elementList& operator=(elementList&&) = default; + template<class... Ts> + explicit elementList(Ts&&... args) + { + std::initializer_list<element*> list = {&args...}; + for (const auto& elem : list) add(*elem); + } + // explicitly clone all the elements elementList(const elementList& rhs); elementList& operator=(const elementList& rhs);