MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Clone

Method Clone

lib/base/dictionary.cpp:233–248  ·  view source on GitHub ↗

* Makes a deep clone of a dictionary * and its elements. * * @returns a copy of the dictionary. */

Source from the content-addressed store, hash-verified

231 * @returns a copy of the dictionary.
232 */
233Object::Ptr Dictionary::Clone() const
234{
235 DictionaryData dict;
236
237 {
238 std::shared_lock<std::shared_timed_mutex> lock (m_DataMutex);
239
240 dict.reserve(GetLength());
241
242 for (const Dictionary::Pair& kv : m_Data) {
243 dict.emplace_back(kv.first, kv.second.Clone());
244 }
245 }
246
247 return new Dictionary(std::move(dict));
248}
249
250/**
251 * Returns an ordered vector containing all keys

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected