From 8b806c07d716db41e0a463d455cf1a913b933a0f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 15 Dec 2022 22:35:52 -0800 Subject: Avoid extraneous temporaries when filling vectors --- core/hrtf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/hrtf.cpp') diff --git a/core/hrtf.cpp b/core/hrtf.cpp index 2b3fdc13..9d0f83ba 100644 --- a/core/hrtf.cpp +++ b/core/hrtf.cpp @@ -51,6 +51,11 @@ HrtfEntry::~HrtfEntry() = default; struct LoadedHrtf { std::string mFilename; std::unique_ptr mEntry; + + template + LoadedHrtf(T&& name, U&& entry) + : mFilename{std::forward(name)}, mEntry{std::forward(entry)} + { } }; /* Data set limits must be the same as or more flexible than those defined in @@ -1421,7 +1426,7 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const uint devrate) TRACE("Loaded HRTF %s for sample rate %uhz, %u-sample filter\n", name.c_str(), hrtf->sampleRate, hrtf->irSize); - handle = LoadedHrtfs.emplace(handle, LoadedHrtf{fname, std::move(hrtf)}); + handle = LoadedHrtfs.emplace(handle, fname, std::move(hrtf)); return HrtfStorePtr{handle->mEntry.get()}; } -- cgit v1.2.3