31 template<
typename K,
typename V>
51 const V&
at(
const K& key)
const
53 const auto searchFn = [&key](
const auto& item) {
return item.first == key;};
54 auto it = ::std::find_if(this->
data.begin(), this->data.end(), searchFn);
55 if (__builtin_expect(it == this->
data.end(), 0))
56 throw ::std::out_of_range(
"Key not found");
67 const auto searchFn = [&key](
const auto& item) {
return item.first == key;};
68 auto it = ::std::find_if(this->
data.begin(), this->data.end(), searchFn);
69 return it != this->
data.end();
78 template<
typename... Args>
81 const auto searchFn = [&key](
const auto& item) {
return item.first == key;};
82 auto it = ::std::find_if(this->
data.begin(), this->data.end(), searchFn);
83 if (__builtin_expect(it == this->
data.end(), 0))
85 ::std::unique_lock<::std::mutex> lock(this->
mutex);
87 it = ::std::find_if(this->
data.begin(), this->data.end(), searchFn);
88 if (__builtin_expect(it == this->
data.end(), 1))
90 it = this->
data.emplace(this->
data.end(), key, V{::std::forward<Args>(args)...});
101 return this->
data.size();
110 return this->
data.empty();
114 ::std::list<::std::pair<K, V>>
data;
139 return ::std::find(this->
data.begin(), this->data.end(), key) != this->
data.end();
149 auto it = std::find(this->
data.begin(), this->data.end(), key);
150 if (__builtin_expect(it == this->
data.end(), 0))
152 std::unique_lock<std::mutex> lock(this->
mutex);
154 it = std::find(this->
data.begin(), this->data.end(), key);
155 if (__builtin_expect(it == this->
data.end(), 1))
157 this->
data.emplace(this->
data.end(), key);
170 return this->
data.size();
179 return this->
data.empty();