summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max.kellermann@ionos.com>2024-10-04 15:05:11 +0200
committerMax Kellermann <max.kellermann@ionos.com>2024-11-13 21:00:29 +0100
commit71c1a2967f2358832086895b79755352bef56aab (patch)
treeb384fb98bb56d27ef45be223b14cdd78da709c6a
parentosd/osd_types: use std::map::insert_or_assign() (diff)
downloadceph-71c1a2967f2358832086895b79755352bef56aab.tar.xz
ceph-71c1a2967f2358832086895b79755352bef56aab.zip
osd/osd_types: perfect forwarding in pool_opts_t::set()
This eliminates temporary objects. Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
-rw-r--r--src/osd/osd_types.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index 19d82a7c259..055fa8bc80c 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -1151,9 +1151,8 @@ public:
bool is_set(key_t key) const;
template<typename T>
- void set(key_t key, const T &val) {
- value_t value = val;
- opts.insert_or_assign(key, value);
+ void set(key_t key, T &&val) {
+ opts.insert_or_assign(key, std::forward<T>(val));
}
template<typename T>