From db169073f195efcb9b35df5c314c65ba39705cef Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Wed, 22 Jul 2015 17:21:54 +0200 Subject: Change how emplacing is being done to avoid unnecessary move_clones on temporaries --- include/tag_compound.h | 2 +- include/tag_list.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/tag_compound.h b/include/tag_compound.h index 1f1c5f3e1a..8e09ff4834 100644 --- a/include/tag_compound.h +++ b/include/tag_compound.h @@ -127,7 +127,7 @@ private: template std::pair tag_compound::emplace(const std::string& key, Args&&... args) { - return put(key, value(T(std::forward(args)...))); + return put(key, value(make_unique(std::forward(args)...))); } } diff --git a/include/tag_list.h b/include/tag_list.h index 137b53d5d1..f1f5e6dec1 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -175,7 +175,7 @@ void tag_list::emplace_back(Args&&... args) el_type_ = T::type; else if(el_type_ != T::type) throw std::bad_cast(); - tags.emplace_back(T(std::forward(args)...)); + tags.emplace_back(make_unique(std::forward(args)...)); } template @@ -184,7 +184,7 @@ void tag_list::init(std::initializer_list init) el_type_ = T::type; tags.reserve(init.size()); for(const Arg& arg: init) - tags.emplace_back(T(arg)); + tags.emplace_back(make_unique(arg)); } } -- cgit 0.0.5-2-1-g0f52