aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/mapfindptr.h
diff options
context:
space:
mode:
authordobrokot <dobrokot@yandex-team.ru>2022-02-10 16:49:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:07 +0300
commit8d57b69dee81198a59c39e64704f7dc9f04b4fbf (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/mapfindptr.h
parent25d83bf841d8b3ce3886525078f1964ac3c293c5 (diff)
downloadydb-8d57b69dee81198a59c39e64704f7dc9f04b4fbf.tar.gz
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/mapfindptr.h')
-rw-r--r--util/generic/mapfindptr.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/util/generic/mapfindptr.h b/util/generic/mapfindptr.h
index fdacd9e997..bc10cac60f 100644
--- a/util/generic/mapfindptr.h
+++ b/util/generic/mapfindptr.h
@@ -1,41 +1,41 @@
-#pragma once
-
+#pragma once
+
#include <type_traits>
-/** MapFindPtr usage:
-
-if (T* value = MapFindPtr(myMap, someKey) {
- Cout << *value;
-}
-
-*/
-
+/** MapFindPtr usage:
+
+if (T* value = MapFindPtr(myMap, someKey) {
+ Cout << *value;
+}
+
+*/
+
template <class Map, class K>
inline auto MapFindPtr(Map& map, const K& key) {
auto i = map.find(key);
return (i == map.end() ? nullptr : &i->second);
-}
-
+}
+
template <class Map, class K>
inline auto MapFindPtr(const Map& map, const K& key) {
auto i = map.find(key);
return (i == map.end() ? nullptr : &i->second);
-}
-
+}
+
/** helper for THashMap/TMap */
template <class Derived>
-struct TMapOps {
+struct TMapOps {
template <class K>
inline auto FindPtr(const K& key) {
- return MapFindPtr(static_cast<Derived&>(*this), key);
- }
+ return MapFindPtr(static_cast<Derived&>(*this), key);
+ }
template <class K>
inline auto FindPtr(const K& key) const {
- return MapFindPtr(static_cast<const Derived&>(*this), key);
- }
+ return MapFindPtr(static_cast<const Derived&>(*this), key);
+ }
template <class K, class DefaultValue>
inline auto Value(const K& key, const DefaultValue& defaultValue) const -> std::remove_reference_t<decltype(*this->FindPtr(key))> {
@@ -57,4 +57,4 @@ struct TMapOps {
template <class K, class V>
inline const V& ValueRef(const K& key, V&& defaultValue) const = delete;
-};
+};