From 6c4d60c5af7d9a64371aa99d038735d1017e710a Mon Sep 17 00:00:00 2001 From: Jakob Rath Date: Tue, 2 Aug 2022 12:30:47 +0200 Subject: [PATCH] Basic support for non-copyable types in map --- src/util/map.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/map.h b/src/util/map.h index 602c042fb..e9880e0a0 100644 --- a/src/util/map.h +++ b/src/util/map.h @@ -33,6 +33,10 @@ struct _key_data { m_key(k), m_value(v) { } + _key_data(Key const& k, Value&& v): + m_key(k), + m_value(std::move(v)) { + } }; template @@ -106,6 +110,10 @@ public: void insert(key const & k, value const & v) { m_table.insert(key_data(k, v)); } + + void insert(key const& k, value&& v) { + m_table.insert(key_data(k, std::move(v))); + } bool insert_if_not_there_core(key const & k, value const & v, entry *& et) { return m_table.insert_if_not_there_core(key_data(k,v), et);