aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-15 22:35:52 -0800
committerChris Robinson <[email protected]>2022-12-15 22:35:52 -0800
commit8b806c07d716db41e0a463d455cf1a913b933a0f (patch)
tree7e4516e8f6e79abbbd06dff84ad2a1d0a4f161a6 /core
parent2bd11bafa4b36977c9d467d5e2d735a8eba1b336 (diff)
Avoid extraneous temporaries when filling vectors
Diffstat (limited to 'core')
-rw-r--r--core/hrtf.cpp7
1 files changed, 6 insertions, 1 deletions
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<HrtfStore> mEntry;
+
+ template<typename T, typename U>
+ LoadedHrtf(T&& name, U&& entry)
+ : mFilename{std::forward<T>(name)}, mEntry{std::forward<U>(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()};
}