diff --git a/include/inja/parser.hpp b/include/inja/parser.hpp index bfc5d6f..a8b6a28 100644 --- a/include/inja/parser.hpp +++ b/include/inja/parser.hpp @@ -625,7 +625,7 @@ public: : config(parser_config), lexer(lexer_config), template_storage(template_storage), function_storage(function_storage) {} Template parse(std::string_view input, std::string_view path) { - auto result = Template(static_cast(input)); + auto result = Template(std::string(input)); parse_into(result, path); return result; } diff --git a/include/inja/template.hpp b/include/inja/template.hpp index 30638e8..be60f54 100644 --- a/include/inja/template.hpp +++ b/include/inja/template.hpp @@ -19,7 +19,7 @@ struct Template { std::map> block_storage; explicit Template() {} - explicit Template(const std::string& content): content(content) {} + explicit Template(std::string content): content(std::move(content)) {} /// Return number of variables (total number, not distinct ones) in the template int count_variables() const { diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 7ea810c..22c27f2 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -824,7 +824,7 @@ struct Template { std::map> block_storage; explicit Template() {} - explicit Template(const std::string& content): content(content) {} + explicit Template(std::string content): content(std::move(content)) {} /// Return number of variables (total number, not distinct ones) in the template int count_variables() const { @@ -2068,7 +2068,7 @@ public: : config(parser_config), lexer(lexer_config), template_storage(template_storage), function_storage(function_storage) {} Template parse(std::string_view input, std::string_view path) { - auto result = Template(static_cast(input)); + auto result = Template(std::string(input)); parse_into(result, path); return result; }