MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / emplace

Function emplace

example/cacheHierarchy/fkYAML/node.hpp:12610–12618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12608 typename KeyType,
12609 detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
12610 std::pair<iterator, bool> emplace(KeyType&& key, const mapped_type& value) noexcept {
12611 for (auto itr = this->begin(); itr != this->end(); ++itr) {
12612 if (m_compare(itr->first, key)) {
12613 return {itr, false};
12614 }
12615 }
12616 this->emplace_back(std::forward<KeyType>(key), value);
12617 return {std::prev(this->end()), true};
12618 }
12619
12620 /// @brief Find a value associated to the given key. Throws an exception if the search fails.
12621 /// @tparam KeyType A type for the input key.

Callers 2

node.hppFile · 0.85
insertMethod · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected