/Users/deen/code/yugabyte-db/src/yb/gutil/map-util.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2005 Google Inc. |
2 | | // |
3 | | // #status: RECOMMENDED |
4 | | // #category: maps |
5 | | // #summary: Utility functions for use with map-like containers. |
6 | | // |
7 | | // This file provides utility functions for use with STL map-like data |
8 | | // structures, such as std::map and hash_map. Some functions will also work with |
9 | | // sets, such as ContainsKey(). |
10 | | // |
11 | | // The main functions in this file fall into the following categories: |
12 | | // |
13 | | // - Find*() |
14 | | // - Contains*() |
15 | | // - Insert*() |
16 | | // - Lookup*() |
17 | | // |
18 | | // These functions often have "...OrDie" or "...OrDieNoPrint" variants. These |
19 | | // variants will crash the process with a CHECK() failure on error, including |
20 | | // the offending key/data in the log message. The NoPrint variants will not |
21 | | // include the key/data in the log output under the assumption that it's not a |
22 | | // printable type. |
23 | | // |
24 | | // Most functions are fairly self explanatory from their names, with the |
25 | | // exception of Find*() vs Lookup*(). The Find functions typically use the map's |
26 | | // .find() member function to locate and return the map's value type. The |
27 | | // Lookup*() functions typically use the map's .insert() (yes, insert) member |
28 | | // function to insert the given value if necessary and returns (usually a |
29 | | // reference to) the map's value type for the found item. |
30 | | // |
31 | | // See the per-function comments for specifics. |
32 | | // |
33 | | // There are also a handful of functions for doing other miscellaneous things. |
34 | | // |
35 | | // A note on terminology: |
36 | | // |
37 | | // Map-like containers are collections of pairs. Like all STL containers they |
38 | | // contain a few standard typedefs identifying the types of data they contain. |
39 | | // Given the following map declaration: |
40 | | // |
41 | | // map<string, int> my_map; |
42 | | // |
43 | | // the notable typedefs would be as follows: |
44 | | // |
45 | | // - key_type -- string |
46 | | // - value_type -- pair<const string, int> |
47 | | // - mapped_type -- int |
48 | | // |
49 | | // Note that the map above contains two types of "values": the key-value pairs |
50 | | // themselves (value_type) and the values within the key-value pairs |
51 | | // (mapped_type). A value_type consists of a key_type and a mapped_type. |
52 | | // |
53 | | // The documentation below is written for programmers thinking in terms of keys |
54 | | // and the (mapped_type) values associated with a given key. For example, the |
55 | | // statement |
56 | | // |
57 | | // my_map["foo"] = 3; |
58 | | // |
59 | | // has a key of "foo" (type: string) with a value of 3 (type: int). |
60 | | // |
61 | | |
62 | | // |
63 | | // The following only applies to changes made to this file as part of YugaByte development. |
64 | | // |
65 | | // Portions Copyright (c) YugaByte, Inc. |
66 | | // |
67 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
68 | | // in compliance with the License. You may obtain a copy of the License at |
69 | | // |
70 | | // http://www.apache.org/licenses/LICENSE-2.0 |
71 | | // |
72 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
73 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
74 | | // or implied. See the License for the specific language governing permissions and limitations |
75 | | // under the License. |
76 | | // |
77 | | #ifndef YB_GUTIL_MAP_UTIL_H |
78 | | #define YB_GUTIL_MAP_UTIL_H |
79 | | |
80 | | #include <string> |
81 | | #include <vector> |
82 | | |
83 | | using std::make_pair; |
84 | | using std::pair; |
85 | | using std::string; |
86 | | using std::vector; |
87 | | |
88 | | |
89 | | |
90 | | // |
91 | | // Find*() |
92 | | // |
93 | | |
94 | | // Returns a const reference to the value associated with the given key if it |
95 | | // exists. Crashes otherwise. |
96 | | // |
97 | | // This is intended as a replacement for operator[] as an rvalue (for reading) |
98 | | // when the key is guaranteed to exist. |
99 | | // |
100 | | // operator[] for lookup is discouraged for several reasons: |
101 | | // * It has a side-effect of inserting missing keys |
102 | | // * It is not thread-safe (even when it is not inserting, it can still |
103 | | // choose to resize the underlying storage) |
104 | | // * It invalidates iterators (when it chooses to resize) |
105 | | // * It default constructs a value object even if it doesn't need to |
106 | | // |
107 | | // This version assumes the key is printable, and includes it in the fatal log |
108 | | // message. |
109 | | template <class Collection> |
110 | | const typename Collection::value_type::second_type& |
111 | | FindOrDie(const Collection& collection, |
112 | 8.41k | const typename Collection::value_type::first_type& key) { |
113 | 8.41k | auto it = collection.find(key); |
114 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; |
115 | 8.41k | return it->second; |
116 | 8.41k | } _Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb5itest14TServerDetailsENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEERKNT_10value_type11second_typeERKSL_RKNSL_10value_type10first_typeE Line | Count | Source | 112 | 12 | const typename Collection::value_type::first_type& key) { | 113 | 12 | auto it = collection.find(key); | 114 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 115 | 12 | return it->second; | 116 | 12 | } |
_Z9FindOrDieINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEERKNT_10value_type11second_typeERKSJ_RKNSJ_10value_type10first_typeE Line | Count | Source | 112 | 2 | const typename Collection::value_type::first_type& key) { | 113 | 2 | auto it = collection.find(key); | 114 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 115 | 2 | return it->second; | 116 | 2 | } |
_Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb5tools16YsckTabletServerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEERKNT_10value_type11second_typeERKSM_RKNSM_10value_type10first_typeE Line | Count | Source | 112 | 8.39k | const typename Collection::value_type::first_type& key) { | 113 | 8.39k | auto it = collection.find(key); | 114 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 115 | 8.39k | return it->second; | 116 | 8.39k | } |
|
117 | | |
118 | | // Same as above, but returns a non-const reference. |
119 | | template <class Collection> |
120 | | typename Collection::value_type::second_type& |
121 | | FindOrDie(Collection& collection, // NOLINT |
122 | 13.5M | const typename Collection::value_type::first_type& key) { |
123 | 13.5M | auto it = collection.find(key); |
124 | 3.22k | CHECK(it != collection.end()) << "Map key not found: " << key; |
125 | 13.5M | return it->second; |
126 | 13.5M | } _Z9FindOrDieINSt3__13mapIN2yb9consensus13TestPeerProxy6MethodENS0_8functionIFvvEEENS0_4lessIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEERNT_10value_type11second_typeERSH_RKNSH_10value_type10first_typeE Line | Count | Source | 122 | 1.01k | const typename Collection::value_type::first_type& key) { | 123 | 1.01k | auto it = collection.find(key); | 124 | 2 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 1.01k | return it->second; | 126 | 1.01k | } |
_Z9FindOrDieINSt3__113unordered_mapIPN2yb9consensus14ConsensusRoundEPNS2_12SynchronizerENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S7_EEEEEEERNT_10value_type11second_typeERSI_RKNSI_10value_type10first_typeE Line | Count | Source | 122 | 173 | const typename Collection::value_type::first_type& key) { | 123 | 173 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 173 | return it->second; | 126 | 173 | } |
_Z9FindOrDieINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEERNT_10value_type11second_typeERSJ_RKNSJ_10value_type10first_typeE Line | Count | Source | 122 | 4 | const typename Collection::value_type::first_type& key) { | 123 | 4 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 4 | return it->second; | 126 | 4 | } |
_Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEERNT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 122 | 11 | const typename Collection::value_type::first_type& key) { | 123 | 11 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 11 | return it->second; | 126 | 11 | } |
_Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10unique_ptrIN2yb5itest14TServerDetailsENS0_14default_deleteISB_EEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SE_EEEEEEERNT_10value_type11second_typeERSO_RKNSO_10value_type10first_typeE Line | Count | Source | 122 | 139 | const typename Collection::value_type::first_type& key) { | 123 | 139 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 139 | return it->second; | 126 | 139 | } |
Unexecuted instantiation: _Z9FindOrDieINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEEERNT_10value_type11second_typeERSG_RKNSG_10value_type10first_typeE _Z9FindOrDieINSt3__113unordered_mapI13scoped_refptrIN2yb6tablet15OperationDriverEENS4_16OperationTracker5StateE23ScopedRefPtrHashFunctor25ScopedRefPtrEqualsFunctorNS0_9allocatorINS0_4pairIKS6_S8_EEEEEEERNT_10value_type11second_typeERSH_RKNSH_10value_type10first_typeE Line | Count | Source | 122 | 13.5M | const typename Collection::value_type::first_type& key) { | 123 | 13.5M | auto it = collection.find(key); | 124 | 3.21k | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 13.5M | return it->second; | 126 | 13.5M | } |
_Z9FindOrDieINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENS0_4hashImEENS0_8equal_toIS3_EENS9_INS0_4pairIKS3_SD_EEEEEEERNT_10value_type11second_typeERSN_RKNSN_10value_type10first_typeE Line | Count | Source | 122 | 5.90k | const typename Collection::value_type::first_type& key) { | 123 | 5.90k | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 5.90k | return it->second; | 126 | 5.90k | } |
_Z9FindOrDieINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS2_10faststringEEEEENS0_4hashImEENS0_8equal_toIS3_EENS0_9allocatorINS0_4pairIKS3_S8_EEEEEEERNT_10value_type11second_typeERSJ_RKNSJ_10value_type10first_typeE Line | Count | Source | 122 | 11 | const typename Collection::value_type::first_type& key) { | 123 | 11 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 11 | return it->second; | 126 | 11 | } |
_Z9FindOrDieINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEERNT_10value_type11second_typeERSF_RKNSF_10value_type10first_typeE Line | Count | Source | 122 | 53.4k | const typename Collection::value_type::first_type& key) { | 123 | 53.4k | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 53.4k | return it->second; | 126 | 53.4k | } |
_Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEERNT_10value_type11second_typeERSL_RKNSL_10value_type10first_typeE Line | Count | Source | 122 | 7 | const typename Collection::value_type::first_type& key) { | 123 | 7 | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 7 | return it->second; | 126 | 7 | } |
_Z9FindOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_NS0_6vectorINS0_4pairIN2yb6StatusEyEENS5_ISC_EEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS9_IKS7_SE_EEEEEESG_SI_NS5_INS9_ISJ_SM_EEEEEEERNT_10value_type11second_typeERSQ_RKNSQ_10value_type10first_typeE Line | Count | Source | 122 | 1.41k | const typename Collection::value_type::first_type& key) { | 123 | 1.41k | auto it = collection.find(key); | 124 | 0 | CHECK(it != collection.end()) << "Map key not found: " << key; | 125 | 1.41k | return it->second; | 126 | 1.41k | } |
|
127 | | |
128 | | // Same as FindOrDie above, but doesn't log the key on failure. |
129 | | template <class Collection> |
130 | | const typename Collection::value_type::second_type& |
131 | | FindOrDieNoPrint(const Collection& collection, |
132 | | const typename Collection::value_type::first_type& key) { |
133 | | typename Collection::const_iterator it = collection.find(key); |
134 | | CHECK(it != collection.end()) << "Map key not found"; |
135 | | return it->second; |
136 | | } |
137 | | |
138 | | // Same as above, but returns a non-const reference. |
139 | | template <class Collection> |
140 | | typename Collection::value_type::second_type& |
141 | | FindOrDieNoPrint(Collection& collection, // NOLINT |
142 | | const typename Collection::value_type::first_type& key) { |
143 | | typename Collection::iterator it = collection.find(key); |
144 | | CHECK(it != collection.end()) << "Map key not found"; |
145 | | return it->second; |
146 | | } |
147 | | |
148 | | // Returns a const reference to the value associated with the given key if it |
149 | | // exists, otherwise a const reference to the provided default value is |
150 | | // returned. |
151 | | // |
152 | | // WARNING: If a temporary object is passed as the default "value," this |
153 | | // function will return a reference to that temporary object, which will be |
154 | | // destroyed by the end of the statement. Specifically, if you have a map with |
155 | | // string values, and you pass a char* as the default "value," either use the |
156 | | // returned value immediately or store it in a string (not string&). Details: |
157 | | template <class Collection> |
158 | | const typename Collection::value_type::second_type& |
159 | | FindWithDefault(const Collection& collection, |
160 | | const typename Collection::value_type::first_type& key, |
161 | 811k | const typename Collection::value_type::second_type& value) { |
162 | 811k | auto it = collection.find(key); |
163 | 811k | if (it == collection.end()) { |
164 | 810k | return value; |
165 | 810k | } |
166 | 1.06k | return it->second; |
167 | 1.06k | } _Z15FindWithDefaultINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiNS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_iEEEEEEERKNT_10value_type11second_typeERKSH_RKNSH_10value_type10first_typeESK_ Line | Count | Source | 161 | 750k | const typename Collection::value_type::second_type& value) { | 162 | 750k | auto it = collection.find(key); | 163 | 750k | if (it == collection.end()) { | 164 | 749k | return value; | 165 | 749k | } | 166 | 1.06k | return it->second; | 167 | 1.06k | } |
Unexecuted instantiation: _Z15FindWithDefaultIN6google8protobuf3MapINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEES9_EEERKNT_10value_type11second_typeERKSB_RKNSB_10value_type10first_typeESE_ _Z15FindWithDefaultINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEERKNT_10value_type11second_typeERKSF_RKNSF_10value_type10first_typeESI_ Line | Count | Source | 161 | 61.5k | const typename Collection::value_type::second_type& value) { | 162 | 61.5k | auto it = collection.find(key); | 163 | 61.5k | if (it == collection.end()) { | 164 | 61.5k | return value; | 165 | 61.5k | } | 166 | 1 | return it->second; | 167 | 1 | } |
|
168 | | |
169 | | // Returns a pointer to the const value associated with the given key if it |
170 | | // exists, or NULL otherwise. |
171 | | template <class Collection> |
172 | | const typename Collection::value_type::second_type* |
173 | | FindOrNull(const Collection& collection, |
174 | 17.1M | const typename Collection::value_type::first_type& key) { |
175 | 17.1M | auto it = collection.find(key); |
176 | 17.1M | if (it == collection.end()) { |
177 | 101k | return 0; |
178 | 101k | } |
179 | 17.0M | return &it->second; |
180 | 17.0M | } _Z10FindOrNullINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master9TableInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEPKNT_10value_type11second_typeERKSK_RKNSK_10value_type10first_typeE Line | Count | Source | 174 | 260k | const typename Collection::value_type::first_type& key) { | 175 | 260k | auto it = collection.find(key); | 176 | 260k | if (it == collection.end()) { | 177 | 0 | return 0; | 178 | 0 | } | 179 | 260k | return &it->second; | 180 | 260k | } |
_Z10FindOrNullINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEPKNT_10value_type11second_typeERKSF_RKNSF_10value_type10first_typeE Line | Count | Source | 174 | 15.3k | const typename Collection::value_type::first_type& key) { | 175 | 15.3k | auto it = collection.find(key); | 176 | 15.3k | if (it == collection.end()) { | 177 | 15.1k | return 0; | 178 | 15.1k | } | 179 | 170 | return &it->second; | 180 | 170 | } |
_Z10FindOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6tablet10TabletPeerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEPKNT_10value_type11second_typeERKSM_RKNSM_10value_type10first_typeE Line | Count | Source | 174 | 16.9M | const typename Collection::value_type::first_type& key) { | 175 | 16.9M | auto it = collection.find(key); | 176 | 16.9M | if (it == collection.end()) { | 177 | 86.2k | return 0; | 178 | 86.2k | } | 179 | 16.8M | return &it->second; | 180 | 16.8M | } |
|
181 | | |
182 | | // Same as above but returns a pointer to the non-const value. |
183 | | template <class Collection> |
184 | | typename Collection::value_type::second_type* |
185 | | FindOrNull(Collection& collection, // NOLINT |
186 | 1.40M | const typename Collection::value_type::first_type& key) { |
187 | 1.40M | auto it = collection.find(key); |
188 | 1.40M | if (it == collection.end()) { |
189 | 196k | return 0; |
190 | 196k | } |
191 | 1.21M | return &it->second; |
192 | 1.21M | } _Z10FindOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6master12TSDescriptorEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEPNT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 186 | 808k | const typename Collection::value_type::first_type& key) { | 187 | 808k | auto it = collection.find(key); | 188 | 808k | if (it == collection.end()) { | 189 | 148 | return 0; | 190 | 148 | } | 191 | 807k | return &it->second; | 192 | 807k | } |
Unexecuted instantiation: _Z10FindOrNullIN6google8protobuf3MapINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEN2yb3cdc15ProducerEntryPBEEEEPNT_10value_type11second_typeERSE_RKNSE_10value_type10first_typeE Unexecuted instantiation: _Z10FindOrNullIN6google8protobuf3MapINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEN2yb3cdc13StreamEntryPBEEEEPNT_10value_type11second_typeERSE_RKNSE_10value_type10first_typeE _Z10FindOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb7tserver15TSTabletManager17TabletReportStateENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEPNT_10value_type11second_typeERSL_RKNSL_10value_type10first_typeE Line | Count | Source | 186 | 338k | const typename Collection::value_type::first_type& key) { | 187 | 338k | auto it = collection.find(key); | 188 | 338k | if (it == collection.end()) { | 189 | 196k | return 0; | 190 | 196k | } | 191 | 142k | return &it->second; | 192 | 142k | } |
_Z10FindOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6tablet10TabletPeerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEPNT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 186 | 261k | const typename Collection::value_type::first_type& key) { | 187 | 261k | auto it = collection.find(key); | 188 | 261k | if (it == collection.end()) { | 189 | 0 | return 0; | 190 | 0 | } | 191 | 261k | return &it->second; | 192 | 261k | } |
|
193 | | |
194 | | // Returns a pointer to the const value associated with the greatest key |
195 | | // that's less than or equal to the given key, or NULL if no such key exists. |
196 | | template <class Collection> |
197 | | const typename Collection::value_type::second_type* |
198 | | FindFloorOrNull(const Collection& collection, |
199 | | const typename Collection::value_type::first_type& key) { |
200 | | auto it = collection.upper_bound(key); |
201 | | if (it == collection.begin()) { |
202 | | return 0; |
203 | | } |
204 | | return &(--it)->second; |
205 | | } |
206 | | |
207 | | // Same as above but returns a pointer to the non-const value. |
208 | | template <class Collection> |
209 | | typename Collection::value_type::second_type* |
210 | | FindFloorOrNull(Collection& collection, // NOLINT |
211 | 9 | const typename Collection::value_type::first_type& key) { |
212 | 9 | auto it = collection.upper_bound(key); |
213 | 9 | if (it == collection.begin()) { |
214 | 3 | return 0; |
215 | 3 | } |
216 | 6 | return &(--it)->second; |
217 | 6 | } |
218 | | |
219 | | // Returns the pointer value associated with the given key. If none is found, |
220 | | // NULL is returned. The function is designed to be used with a map of keys to |
221 | | // pointers. |
222 | | // |
223 | | // This function does not distinguish between a missing key and a key mapped |
224 | | // to a NULL value. |
225 | | template <class Collection> |
226 | | typename Collection::value_type::second_type |
227 | | FindPtrOrNull(const Collection& collection, |
228 | 1.70M | const typename Collection::value_type::first_type& key) { |
229 | 1.70M | auto it = collection.find(key); |
230 | 1.70M | if (it == collection.end()) { |
231 | 385k | return typename Collection::value_type::second_type(0); |
232 | 385k | } |
233 | 1.31M | return it->second; |
234 | 1.31M | } _Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus9PeerProxyENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEENT_10value_type11second_typeERKSL_RKNSL_10value_type10first_typeE Line | Count | Source | 228 | 396 | const typename Collection::value_type::first_type& key) { | 229 | 396 | auto it = collection.find(key); | 230 | 396 | if (it == collection.end()) { | 231 | 0 | return typename Collection::value_type::second_type(0); | 232 | 0 | } | 233 | 396 | return it->second; | 234 | 396 | } |
_Z13FindPtrOrNullINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master9TableInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERKSK_RKNSK_10value_type10first_typeE Line | Count | Source | 228 | 923k | const typename Collection::value_type::first_type& key) { | 229 | 923k | auto it = collection.find(key); | 230 | 923k | if (it == collection.end()) { | 231 | 317k | return typename Collection::value_type::second_type(0); | 232 | 317k | } | 233 | 606k | return it->second; | 234 | 606k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERKSM_RKNSM_10value_type10first_typeE Line | Count | Source | 228 | 163k | const typename Collection::value_type::first_type& key) { | 229 | 163k | auto it = collection.find(key); | 230 | 163k | if (it == collection.end()) { | 231 | 14.1k | return typename Collection::value_type::second_type(0); | 232 | 14.1k | } | 233 | 149k | return it->second; | 234 | 149k | } |
_Z13FindPtrOrNullINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10TabletInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERKSK_RKNSK_10value_type10first_typeE Line | Count | Source | 228 | 602k | const typename Collection::value_type::first_type& key) { | 229 | 602k | auto it = collection.find(key); | 230 | 602k | if (it == collection.end()) { | 231 | 53.7k | return typename Collection::value_type::second_type(0); | 232 | 53.7k | } | 233 | 548k | return it->second; | 234 | 548k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master13NamespaceInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERKSM_RKNSM_10value_type10first_typeE Line | Count | Source | 228 | 13.1k | const typename Collection::value_type::first_type& key) { | 229 | 13.1k | auto it = collection.find(key); | 230 | 13.1k | if (it == collection.end()) { | 231 | 4 | return typename Collection::value_type::second_type(0); | 232 | 4 | } | 233 | 13.1k | return it->second; | 234 | 13.1k | } |
Unexecuted instantiation: _Z13FindPtrOrNullINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEENT_10value_type11second_typeERKSJ_RKNSJ_10value_type10first_typeE |
235 | | |
236 | | // Same as above, except takes non-const reference to collection. |
237 | | // |
238 | | // This function is needed for containers that propagate constness to the |
239 | | // pointee, such as boost::ptr_map. |
240 | | template <class Collection> |
241 | | typename Collection::value_type::second_type |
242 | | FindPtrOrNull(Collection& collection, // NOLINT |
243 | 59.4M | const typename Collection::value_type::first_type& key) { |
244 | 59.4M | auto it = collection.find(key); |
245 | 59.4M | if (it == collection.end()) { |
246 | 10.4M | return typename Collection::value_type::second_type(0); |
247 | 10.4M | } |
248 | 48.9M | return it->second; |
249 | 48.9M | } _Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 38.8M | const typename Collection::value_type::first_type& key) { | 244 | 38.8M | auto it = collection.find(key); | 245 | 38.8M | if (it == collection.end()) { | 246 | 5 | return typename Collection::value_type::second_type(0); | 247 | 5 | } | 248 | 38.8M | return it->second; | 249 | 38.8M | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_4pairINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_EE13scoped_refptrIN2yb6master9TableInfoEEN5boost4hashIS9_EENS0_8equal_toIS9_EENS6_INS2_IKS9_SE_EEEEEEENT_10value_type11second_typeERSO_RKNSO_10value_type10first_typeE Line | Count | Source | 243 | 38.3k | const typename Collection::value_type::first_type& key) { | 244 | 38.3k | auto it = collection.find(key); | 245 | 38.3k | if (it == collection.end()) { | 246 | 29.4k | return typename Collection::value_type::second_type(0); | 247 | 29.4k | } | 248 | 8.94k | return it->second; | 249 | 8.94k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master13NamespaceInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 127k | const typename Collection::value_type::first_type& key) { | 244 | 127k | auto it = collection.find(key); | 245 | 127k | if (it == collection.end()) { | 246 | 10.8k | return typename Collection::value_type::second_type(0); | 247 | 10.8k | } | 248 | 117k | return it->second; | 249 | 117k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10UDTypeInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 128 | const typename Collection::value_type::first_type& key) { | 244 | 128 | auto it = collection.find(key); | 245 | 128 | if (it == collection.end()) { | 246 | 45 | return typename Collection::value_type::second_type(0); | 247 | 45 | } | 248 | 83 | return it->second; | 249 | 83 | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master15RedisConfigInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 291 | const typename Collection::value_type::first_type& key) { | 244 | 291 | auto it = collection.find(key); | 245 | 291 | if (it == collection.end()) { | 246 | 291 | return typename Collection::value_type::second_type(0); | 247 | 291 | } | 248 | 0 | return it->second; | 249 | 0 | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_4pairINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_EE13scoped_refptrIN2yb6master10UDTypeInfoEEN5boost4hashIS9_EENS0_8equal_toIS9_EENS6_INS2_IKS9_SE_EEEEEEENT_10value_type11second_typeERSO_RKNSO_10value_type10first_typeE Line | Count | Source | 243 | 154 | const typename Collection::value_type::first_type& key) { | 244 | 154 | auto it = collection.find(key); | 245 | 154 | if (it == collection.end()) { | 246 | 54 | return typename Collection::value_type::second_type(0); | 247 | 54 | } | 248 | 100 | return it->second; | 249 | 100 | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master8RoleInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 6.52k | const typename Collection::value_type::first_type& key) { | 244 | 6.52k | auto it = collection.find(key); | 245 | 6.52k | if (it == collection.end()) { | 246 | 2.34k | return typename Collection::value_type::second_type(0); | 247 | 2.34k | } | 248 | 4.17k | return it->second; | 249 | 4.17k | } |
Unexecuted instantiation: _Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master12SnapshotInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE _Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master13CDCStreamInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 2.71k | const typename Collection::value_type::first_type& key) { | 244 | 2.71k | auto it = collection.find(key); | 245 | 2.71k | if (it == collection.end()) { | 246 | 158 | return typename Collection::value_type::second_type(0); | 247 | 158 | } | 248 | 2.55k | return it->second; | 249 | 2.55k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master23UniverseReplicationInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeERSM_RKNSM_10value_type10first_typeE Line | Count | Source | 243 | 2 | const typename Collection::value_type::first_type& key) { | 244 | 2 | auto it = collection.find(key); | 245 | 2 | if (it == collection.end()) { | 246 | 2 | return typename Collection::value_type::second_type(0); | 247 | 2 | } | 248 | 0 | return it->second; | 249 | 0 | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6client8internal12RemoteTabletEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SD_EEEEEEENT_10value_type11second_typeERSN_RKNSN_10value_type10first_typeE Line | Count | Source | 243 | 74.3k | const typename Collection::value_type::first_type& key) { | 244 | 74.3k | auto it = collection.find(key); | 245 | 74.3k | if (it == collection.end()) { | 246 | 70.6k | return typename Collection::value_type::second_type(0); | 247 | 70.6k | } | 248 | 3.72k | return it->second; | 249 | 3.72k | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEENT_10value_type11second_typeERSL_RKNSL_10value_type10first_typeE Line | Count | Source | 243 | 40 | const typename Collection::value_type::first_type& key) { | 244 | 40 | auto it = collection.find(key); | 245 | 40 | if (it == collection.end()) { | 246 | 0 | return typename Collection::value_type::second_type(0); | 247 | 0 | } | 248 | 40 | return it->second; | 249 | 40 | } |
_Z13FindPtrOrNullINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEENT_10value_type11second_typeERSJ_RKNSJ_10value_type10first_typeE Line | Count | Source | 243 | 20.0M | const typename Collection::value_type::first_type& key) { | 244 | 20.0M | auto it = collection.find(key); | 245 | 20.0M | if (it == collection.end()) { | 246 | 10.1M | return typename Collection::value_type::second_type(0); | 247 | 10.1M | } | 248 | 9.88M | return it->second; | 249 | 9.88M | } |
_Z13FindPtrOrNullINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb12MetricEntityEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEENT_10value_type11second_typeERSL_RKNSL_10value_type10first_typeE Line | Count | Source | 243 | 208k | const typename Collection::value_type::first_type& key) { | 244 | 208k | auto it = collection.find(key); | 245 | 208k | if (it == collection.end()) { | 246 | 130k | return typename Collection::value_type::second_type(0); | 247 | 130k | } | 248 | 77.7k | return it->second; | 249 | 77.7k | } |
|
250 | | |
251 | | // Finds the value associated with the given key and copies it to *value (if not |
252 | | // NULL). Returns false if the key was not found, true otherwise. |
253 | | template <class Collection, class Key, class Value> |
254 | | bool FindCopy(const Collection& collection, |
255 | | const Key& key, |
256 | 28.6M | Value* const value) { |
257 | 28.6M | auto it = collection.find(key); |
258 | 28.6M | if (it == collection.end()) { |
259 | 89.6k | return false; |
260 | 89.6k | } |
261 | 28.5M | if (value) { |
262 | 28.5M | *value = it->second; |
263 | 28.5M | } |
264 | 28.5M | return true; |
265 | 28.5M | } _Z8FindCopyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb9consensus13RaftConsensusEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_SC_EbRKT_RKT0_PT1_ Line | Count | Source | 256 | 1.10k | Value* const value) { | 257 | 1.10k | auto it = collection.find(key); | 258 | 1.10k | if (it == collection.end()) { | 259 | 19 | return false; | 260 | 19 | } | 261 | 1.08k | if (value) { | 262 | 1.08k | *value = it->second; | 263 | 1.08k | } | 264 | 1.08k | return true; | 265 | 1.08k | } |
_Z8FindCopyINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEExS7_EbRKT_RKT0_PT1_ Line | Count | Source | 256 | 28.6M | Value* const value) { | 257 | 28.6M | auto it = collection.find(key); | 258 | 28.6M | if (it == collection.end()) { | 259 | 89.5k | return false; | 260 | 89.5k | } | 261 | 28.5M | if (value) { | 262 | 28.5M | *value = it->second; | 263 | 28.5M | } | 264 | 28.5M | return true; | 265 | 28.5M | } |
_Z8FindCopyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10TabletInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_SC_EbRKT_RKT0_PT1_ Line | Count | Source | 256 | 9.22k | Value* const value) { | 257 | 9.22k | auto it = collection.find(key); | 258 | 9.22k | if (it == collection.end()) { | 259 | 0 | return false; | 260 | 0 | } | 261 | 9.22k | if (value) { | 262 | 9.22k | *value = it->second; | 263 | 9.22k | } | 264 | 9.22k | return true; | 265 | 9.22k | } |
_Z8FindCopyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEA3_cS7_EbRKT_RKT0_PT1_ Line | Count | Source | 256 | 50 | Value* const value) { | 257 | 50 | auto it = collection.find(key); | 258 | 50 | if (it == collection.end()) { | 259 | 2 | return false; | 260 | 2 | } | 261 | 48 | if (value) { | 262 | 48 | *value = it->second; | 263 | 48 | } | 264 | 48 | return true; | 265 | 48 | } |
_Z8FindCopyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmNS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_mEEEEEES7_mEbRKT_RKT0_PT1_ Line | Count | Source | 256 | 5 | Value* const value) { | 257 | 5 | auto it = collection.find(key); | 258 | 5 | if (it == collection.end()) { | 259 | 1 | return false; | 260 | 1 | } | 261 | 4 | if (value) { | 262 | 4 | *value = it->second; | 263 | 4 | } | 264 | 4 | return true; | 265 | 4 | } |
|
266 | | |
267 | | // |
268 | | // Contains*() |
269 | | // |
270 | | |
271 | | // Returns true iff the given collection contains the given key. |
272 | | template <class Collection, class Key> |
273 | 72.5M | bool ContainsKey(const Collection& collection, const Key& key) { |
274 | 72.5M | auto it = collection.find(key); |
275 | 72.5M | return it != collection.end(); |
276 | 72.5M | } _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb5itest14TServerDetailsENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 4 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 4 | auto it = collection.find(key); | 275 | 4 | return it != collection.end(); | 276 | 4 | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA7_cEbRKT_RKT0_ Line | Count | Source | 273 | 2 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 2 | auto it = collection.find(key); | 275 | 2 | return it != collection.end(); | 276 | 2 | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA9_cEbRKT_RKT0_ Line | Count | Source | 273 | 1 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 1 | auto it = collection.find(key); | 275 | 1 | return it != collection.end(); | 276 | 1 | } |
_Z11ContainsKeyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEA2_cEbRKT_RKT0_ Line | Count | Source | 273 | 1 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 1 | auto it = collection.find(key); | 275 | 1 | return it != collection.end(); | 276 | 1 | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 638k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 638k | auto it = collection.find(key); | 275 | 638k | return it != collection.end(); | 276 | 638k | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA16_cEbRKT_RKT0_ Line | Count | Source | 273 | 1 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 1 | auto it = collection.find(key); | 275 | 1 | return it != collection.end(); | 276 | 1 | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA10_cEbRKT_RKT0_ Line | Count | Source | 273 | 1 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 1 | auto it = collection.find(key); | 275 | 1 | return it != collection.end(); | 276 | 1 | } |
_Z11ContainsKeyINSt3__113unordered_setIiNS0_4hashIiEENS0_8equal_toIiEENS0_9allocatorIiEEEEiEbRKT_RKT0_ Line | Count | Source | 273 | 200k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 200k | auto it = collection.find(key); | 275 | 200k | return it != collection.end(); | 276 | 200k | } |
_Z11ContainsKeyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus12ElectionVoteENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 164k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 164k | auto it = collection.find(key); | 275 | 164k | return it != collection.end(); | 276 | 164k | } |
_Z11ContainsKeyINSt3__13setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4lessIS7_EENS5_IS7_EEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 1.34M | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 1.34M | auto it = collection.find(key); | 275 | 1.34M | return it != collection.end(); | 276 | 1.34M | } |
_Z11ContainsKeyINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEExEbRKT_RKT0_ Line | Count | Source | 273 | 89.2k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 89.2k | auto it = collection.find(key); | 275 | 89.2k | return it != collection.end(); | 276 | 89.2k | } |
_Z11ContainsKeyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master9TableInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 210k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 210k | auto it = collection.find(key); | 275 | 210k | return it != collection.end(); | 276 | 210k | } |
_Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master13NamespaceInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 3.13k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 3.13k | auto it = collection.find(key); | 275 | 3.13k | return it != collection.end(); | 276 | 3.13k | } |
Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10UDTypeInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master15RedisConfigInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master13CDCStreamInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master23UniverseReplicationInfoEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEES7_EbRKT_RKT0_ _Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA15_cEbRKT_RKT0_ Line | Count | Source | 273 | 449 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 449 | auto it = collection.find(key); | 275 | 449 | return it != collection.end(); | 276 | 449 | } |
_Z11ContainsKeyINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEA8_cEbRKT_RKT0_ Line | Count | Source | 273 | 243 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 243 | auto it = collection.find(key); | 275 | 243 | return it != collection.end(); | 276 | 243 | } |
_Z11ContainsKeyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEA4_cEbRKT_RKT0_ Line | Count | Source | 273 | 73 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 73 | auto it = collection.find(key); | 275 | 73 | return it != collection.end(); | 276 | 73 | } |
_Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_S7_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 68 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 68 | auto it = collection.find(key); | 275 | 68 | return it != collection.end(); | 276 | 68 | } |
Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb7tserver10enterprise9CDCClientEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SD_EEEEEES7_EbRKT_RKT0_ _Z11ContainsKeyINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS2_10faststringEEEEENS0_4hashImEENS0_8equal_toIS3_EENS0_9allocatorINS0_4pairIKS3_S8_EEEEEES3_EbRKT_RKT0_ Line | Count | Source | 273 | 11.1k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 11.1k | auto it = collection.find(key); | 275 | 11.1k | return it != collection.end(); | 276 | 11.1k | } |
Unexecuted instantiation: _Z11ContainsKeyINSt3__113unordered_setImNS0_4hashImEENS0_8equal_toImEENS0_9allocatorImEEEEmEbRKT_RKT0_ _Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 3 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 3 | auto it = collection.find(key); | 275 | 3 | return it != collection.end(); | 276 | 3 | } |
_Z11ContainsKeyINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb17InMemoryFileStateEEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SB_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 42 | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 42 | auto it = collection.find(key); | 275 | 42 | return it != collection.end(); | 276 | 42 | } |
_Z11ContainsKeyINSt3__113unordered_setIyNS0_4hashIyEENS0_8equal_toIyEENS0_9allocatorIyEEEEyEbRKT_RKT0_ Line | Count | Source | 273 | 69.3M | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 69.3M | auto it = collection.find(key); | 275 | 69.3M | return it != collection.end(); | 276 | 69.3M | } |
_Z11ContainsKeyINSt3__113unordered_setIPN2yb6ThreadENS0_4hashIS4_EENS0_8equal_toIS4_EENS0_9allocatorIS4_EEEES4_EbRKT_RKT0_ Line | Count | Source | 273 | 448k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 448k | auto it = collection.find(key); | 275 | 448k | return it != collection.end(); | 276 | 448k | } |
_Z11ContainsKeyINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_NS0_6vectorINS0_4pairIN2yb6StatusEyEENS5_ISC_EEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS9_IKS7_SE_EEEEEESG_SI_NS5_INS9_ISJ_SM_EEEEEES7_EbRKT_RKT0_ Line | Count | Source | 273 | 12.3k | bool ContainsKey(const Collection& collection, const Key& key) { | 274 | 12.3k | auto it = collection.find(key); | 275 | 12.3k | return it != collection.end(); | 276 | 12.3k | } |
|
277 | | |
278 | | // Returns true iff the given collection contains the given key-value pair. |
279 | | template <class Collection, class Key, class Value> |
280 | | bool ContainsKeyValuePair(const Collection& collection, |
281 | | const Key& key, |
282 | | const Value& value) { |
283 | | typedef typename Collection::const_iterator const_iterator; |
284 | | pair<const_iterator, const_iterator> range = collection.equal_range(key); |
285 | | for (const_iterator it = range.first; it != range.second; ++it) { |
286 | | if (it->second == value) { |
287 | | return true; |
288 | | } |
289 | | } |
290 | | return false; |
291 | | } |
292 | | |
293 | | // |
294 | | // Insert*() |
295 | | // |
296 | | |
297 | | // Inserts the given key-value pair into the collection. Returns true if the |
298 | | // given key didn't previously exist. If the given key already existed in the |
299 | | // map, its value is changed to the given "value" and false is returned. |
300 | | template <class Collection> |
301 | | bool InsertOrUpdate(Collection* const collection, |
302 | 11.2k | const typename Collection::value_type& vt) { |
303 | 11.2k | pair<typename Collection::iterator, bool> ret = collection->insert(vt); |
304 | 11.2k | if (!ret.second) { |
305 | | // update |
306 | 3.85k | ret.first->second = vt.second; |
307 | 3.85k | return false; |
308 | 3.85k | } |
309 | 7.37k | return true; |
310 | 7.37k | } |
311 | | |
312 | | // Same as above, except that the key and value are passed separately. |
313 | | template <class Collection> |
314 | | bool InsertOrUpdate(Collection* const collection, |
315 | | const typename Collection::value_type::first_type& key, |
316 | 11.2k | const typename Collection::value_type::second_type& value) { |
317 | 11.2k | return InsertOrUpdate( |
318 | 11.2k | collection, typename Collection::value_type(key, value)); |
319 | 11.2k | } |
320 | | |
321 | | // Inserts/updates all the key-value pairs from the range defined by the |
322 | | // iterators "first" and "last" into the given collection. |
323 | | template <class Collection, class InputIterator> |
324 | | void InsertOrUpdateMany(Collection* const collection, |
325 | | InputIterator first, InputIterator last) { |
326 | | for (; first != last; ++first) { |
327 | | InsertOrUpdate(collection, *first); |
328 | | } |
329 | | } |
330 | | |
331 | | // Change the value associated with a particular key in a map or hash_map |
332 | | // of the form map<Key, Value*> which owns the objects pointed to by the |
333 | | // value pointers. If there was an existing value for the key, it is deleted. |
334 | | // True indicates an insert took place, false indicates an update + delete. |
335 | | template <class Collection> |
336 | | bool InsertAndDeleteExisting( |
337 | | Collection* const collection, |
338 | | const typename Collection::value_type::first_type& key, |
339 | | const typename Collection::value_type::second_type& value) { |
340 | | pair<typename Collection::iterator, bool> ret = |
341 | | collection->insert(typename Collection::value_type(key, value)); |
342 | | if (!ret.second) { |
343 | | delete ret.first->second; |
344 | | ret.first->second = value; |
345 | | return false; |
346 | | } |
347 | | return true; |
348 | | } |
349 | | |
350 | | // Inserts the given key and value into the given collection iff the given key |
351 | | // did NOT already exist in the collection. If the key previously existed in the |
352 | | // collection, the value is not changed. Returns true if the key-value pair was |
353 | | // inserted; returns false if the key was already present. |
354 | | template <class Collection> |
355 | | bool InsertIfNotPresent(Collection* const collection, |
356 | 145M | const typename Collection::value_type& vt) { |
357 | 145M | return collection->insert(vt).second; |
358 | 145M | } _Z18InsertIfNotPresentINSt3__13mapIN2yb9consensus13TestPeerProxy6MethodENS0_8functionIFvvEEENS0_4lessIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEbPT_RKNSH_10value_typeE Line | Count | Source | 356 | 1.01k | const typename Collection::value_type& vt) { | 357 | 1.01k | return collection->insert(vt).second; | 358 | 1.01k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus9PeerProxyENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 1.69k | const typename Collection::value_type& vt) { | 357 | 1.69k | return collection->insert(vt).second; | 358 | 1.69k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIN2yb6OpIdPBENS2_9consensus15OpIdHashFunctorENS4_17OpIdEqualsFunctorENS0_9allocatorIS3_EEEEEbPT_RKNSA_10value_typeE Line | Count | Source | 356 | 318 | const typename Collection::value_type& vt) { | 357 | 318 | return collection->insert(vt).second; | 358 | 318 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIPN2yb9consensus14ConsensusRoundEPNS2_12SynchronizerENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S7_EEEEEEEbPT_RKNSI_10value_typeE Line | Count | Source | 356 | 172 | const typename Collection::value_type& vt) { | 357 | 172 | return collection->insert(vt).second; | 358 | 172 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb9consensus13RaftConsensusEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_typeE Line | Count | Source | 356 | 23 | const typename Collection::value_type& vt) { | 357 | 23 | return collection->insert(vt).second; | 358 | 23 | } |
Unexecuted instantiation: _Z18InsertIfNotPresentINSt3__13setIlNS0_4lessIlEENS0_9allocatorIlEEEEEbPT_RKNS7_10value_typeE _Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb5itest14TServerDetailsENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 9 | const typename Collection::value_type& vt) { | 357 | 9 | return collection->insert(vt).second; | 358 | 9 | } |
Unexecuted instantiation: _Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEbPT_RKNSH_10value_typeE _Z18InsertIfNotPresentINSt3__113unordered_setIPN2yb5itest14TServerDetailsENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorIS5_EEEEEbPT_RKNSD_10value_typeE Line | Count | Source | 356 | 1 | const typename Collection::value_type& vt) { | 357 | 1 | return collection->insert(vt).second; | 358 | 1 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb6master13TabletReplicaENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSK_10value_typeE Line | Count | Source | 356 | 869 | const typename Collection::value_type& vt) { | 357 | 869 | return collection->insert(vt).second; | 358 | 869 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb5tools16YsckTabletServerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_typeE Line | Count | Source | 356 | 2.86k | const typename Collection::value_type& vt) { | 357 | 2.86k | return collection->insert(vt).second; | 358 | 2.86k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEEbPT_RKNSE_10value_typeE Line | Count | Source | 356 | 440k | const typename Collection::value_type& vt) { | 357 | 440k | return collection->insert(vt).second; | 358 | 440k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIPN2yb11threadlocal7CounterENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorIS5_EEEEEbPT_RKNSD_10value_typeE Line | Count | Source | 356 | 24 | const typename Collection::value_type& vt) { | 357 | 24 | return collection->insert(vt).second; | 358 | 24 | } |
_Z18InsertIfNotPresentINSt3__13mapIN2yb5SliceEiNS3_10ComparatorENS0_9allocatorINS0_4pairIKS3_iEEEEEEEbPT_RKNSB_10value_typeE Line | Count | Source | 356 | 3 | const typename Collection::value_type& vt) { | 357 | 3 | return collection->insert(vt).second; | 358 | 3 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_typeE Line | Count | Source | 356 | 158k | const typename Collection::value_type& vt) { | 357 | 158k | return collection->insert(vt).second; | 358 | 158k | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus12ElectionVoteENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSI_10value_typeE Line | Count | Source | 356 | 164k | const typename Collection::value_type& vt) { | 357 | 164k | return collection->insert(vt).second; | 358 | 164k | } |
_Z18InsertIfNotPresentINSt3__13mapIxN2yb9consensus8LogCache10CacheEntryENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS5_EEEEEEEbPT_RKNSE_10value_typeE Line | Count | Source | 356 | 88.7k | const typename Collection::value_type& vt) { | 357 | 88.7k | return collection->insert(vt).second; | 358 | 88.7k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus10RaftPeerPBENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSK_10value_typeE Line | Count | Source | 356 | 113k | const typename Collection::value_type& vt) { | 357 | 113k | return collection->insert(vt).second; | 358 | 113k | } |
_Z18InsertIfNotPresentINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEEEbPT_RKNSG_10value_typeE Line | Count | Source | 356 | 89.2k | const typename Collection::value_type& vt) { | 357 | 89.2k | return collection->insert(vt).second; | 358 | 89.2k | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10TabletInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSK_10value_typeE Line | Count | Source | 356 | 53.7k | const typename Collection::value_type& vt) { | 357 | 53.7k | return collection->insert(vt).second; | 358 | 53.7k | } |
_Z18InsertIfNotPresentINSt3__13setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4lessIS7_EENS5_IS7_EEEEEbPT_RKNSC_10value_typeE Line | Count | Source | 356 | 82.1k | const typename Collection::value_type& vt) { | 357 | 82.1k | return collection->insert(vt).second; | 358 | 82.1k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6master12TSDescriptorEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_typeE Line | Count | Source | 356 | 5.53k | const typename Collection::value_type& vt) { | 357 | 5.53k | return collection->insert(vt).second; | 358 | 5.53k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6tablet10TabletPeerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_typeE Line | Count | Source | 356 | 83.4k | const typename Collection::value_type& vt) { | 357 | 83.4k | return collection->insert(vt).second; | 358 | 83.4k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb7tserver15TSTabletManager17TabletReportStateENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 196k | const typename Collection::value_type& vt) { | 357 | 196k | return collection->insert(vt).second; | 358 | 196k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS2_10faststringEEEEENS0_4hashImEENS0_8equal_toIS3_EENS0_9allocatorINS0_4pairIKS3_S8_EEEEEEEbPT_RKNSJ_10value_typeE Line | Count | Source | 356 | 17.3k | const typename Collection::value_type& vt) { | 357 | 17.3k | return collection->insert(vt).second; | 358 | 17.3k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENS0_4hashImEENS0_8equal_toIS3_EENS9_INS0_4pairIKS3_SD_EEEEEEEbPT_RKNSN_10value_typeE Line | Count | Source | 356 | 65.2k | const typename Collection::value_type& vt) { | 357 | 65.2k | return collection->insert(vt).second; | 358 | 65.2k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapI12GStringPiecemNS0_4hashIS2_EENS0_8equal_toIS2_EEN2yb20STLCountingAllocatorINS0_4pairIKS2_mEENS0_9allocatorISB_EEEEEEEbPT_RKNSG_10value_typeE Line | Count | Source | 356 | 39.0M | const typename Collection::value_type& vt) { | 357 | 39.0M | return collection->insert(vt).second; | 358 | 39.0M | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEbPT_RKNSF_10value_typeE Line | Count | Source | 356 | 17.8k | const typename Collection::value_type& vt) { | 357 | 17.8k | return collection->insert(vt).second; | 358 | 17.8k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setImNS0_4hashImEENS0_8equal_toImEENS0_9allocatorImEEEEEbPT_RKNS9_10value_typeE Line | Count | Source | 356 | 11.2k | const typename Collection::value_type& vt) { | 357 | 11.2k | return collection->insert(vt).second; | 358 | 11.2k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIxPN2yb5debug8TraceLog13PerThreadInfoENS0_4hashIxEENS0_8equal_toIxEENS0_9allocatorINS0_4pairIKxS6_EEEEEEEbPT_RKNSH_10value_typeE Line | Count | Source | 356 | 18 | const typename Collection::value_type& vt) { | 357 | 18 | return collection->insert(vt).second; | 358 | 18 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 1 | const typename Collection::value_type& vt) { | 357 | 1 | return collection->insert(vt).second; | 358 | 1 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb8CallbackIFvRKS7_RKNS8_6StatusEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairISA_SG_EEEEEEEbPT_RKNSP_10value_typeE Line | Count | Source | 356 | 1 | const typename Collection::value_type& vt) { | 357 | 1 | return collection->insert(vt).second; | 358 | 1 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb15FailureDetectorEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 1 | const typename Collection::value_type& vt) { | 357 | 1 | return collection->insert(vt).second; | 358 | 1 | } |
_Z18InsertIfNotPresentINSt3__13mapIPKc13scoped_refptrIN2yb6MetricEENS0_4lessIS3_EENS0_9allocatorINS0_4pairIKS3_S7_EEEEEEEbPT_RKNSG_10value_typeE Line | Count | Source | 356 | 80.7M | const typename Collection::value_type& vt) { | 357 | 80.7M | return collection->insert(vt).second; | 358 | 80.7M | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEbPT_RKNSJ_10value_typeE Line | Count | Source | 356 | 10.1M | const typename Collection::value_type& vt) { | 357 | 10.1M | return collection->insert(vt).second; | 358 | 10.1M | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb12MetricEntityEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_typeE Line | Count | Source | 356 | 130k | const typename Collection::value_type& vt) { | 357 | 130k | return collection->insert(vt).second; | 358 | 130k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIN5boost4asio2ip14basic_endpointINS4_3tcpEEEN2yb12EndpointHashENS0_8equal_toIS7_EENS0_9allocatorIS7_EEEEEbPT_RKNSF_10value_typeE Line | Count | Source | 356 | 35.6k | const typename Collection::value_type& vt) { | 357 | 35.6k | return collection->insert(vt).second; | 358 | 35.6k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIPKN6google8protobuf14FileDescriptorENS0_4hashIS6_EENS0_8equal_toIS6_EENS0_9allocatorIS6_EEEEEbPT_RKNSE_10value_typeE Line | Count | Source | 356 | 13.2M | const typename Collection::value_type& vt) { | 357 | 13.2M | return collection->insert(vt).second; | 358 | 13.2M | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIPN2yb15ThreadPoolTokenENS0_4hashIS4_EENS0_8equal_toIS4_EENS0_9allocatorIS4_EEEEEbPT_RKNSC_10value_typeE Line | Count | Source | 356 | 622k | const typename Collection::value_type& vt) { | 357 | 622k | return collection->insert(vt).second; | 358 | 622k | } |
_Z18InsertIfNotPresentINSt3__113unordered_setIPN2yb6ThreadENS0_4hashIS4_EENS0_8equal_toIS4_EENS0_9allocatorIS4_EEEEEbPT_RKNSC_10value_typeE Line | Count | Source | 356 | 354k | const typename Collection::value_type& vt) { | 357 | 354k | return collection->insert(vt).second; | 358 | 354k | } |
|
359 | | |
360 | | // Same as above except the key and value are passed separately. |
361 | | template <class Collection> |
362 | | bool InsertIfNotPresent( |
363 | | Collection* const collection, |
364 | | const typename Collection::value_type::first_type& key, |
365 | 131M | const typename Collection::value_type::second_type& value) { |
366 | 131M | return InsertIfNotPresent( |
367 | 131M | collection, typename Collection::value_type(key, value)); |
368 | 131M | } _Z18InsertIfNotPresentINSt3__13mapIN2yb9consensus13TestPeerProxy6MethodENS0_8functionIFvvEEENS0_4lessIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEbPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE Line | Count | Source | 365 | 1.01k | const typename Collection::value_type::second_type& value) { | 366 | 1.01k | return InsertIfNotPresent( | 367 | 1.01k | collection, typename Collection::value_type(key, value)); | 368 | 1.01k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus9PeerProxyENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 1.69k | const typename Collection::value_type::second_type& value) { | 366 | 1.69k | return InsertIfNotPresent( | 367 | 1.69k | collection, typename Collection::value_type(key, value)); | 368 | 1.69k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIPN2yb9consensus14ConsensusRoundEPNS2_12SynchronizerENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S7_EEEEEEEbPT_RKNSI_10value_type10first_typeERKNSI_10value_type11second_typeE Line | Count | Source | 365 | 172 | const typename Collection::value_type::second_type& value) { | 366 | 172 | return InsertIfNotPresent( | 367 | 172 | collection, typename Collection::value_type(key, value)); | 368 | 172 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb9consensus13RaftConsensusEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 365 | 23 | const typename Collection::value_type::second_type& value) { | 366 | 23 | return InsertIfNotPresent( | 367 | 23 | collection, typename Collection::value_type(key, value)); | 368 | 23 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb5itest14TServerDetailsENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 9 | const typename Collection::value_type::second_type& value) { | 366 | 9 | return InsertIfNotPresent( | 367 | 9 | collection, typename Collection::value_type(key, value)); | 368 | 9 | } |
Unexecuted instantiation: _Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEbPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE _Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb6master13TabletReplicaENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 365 | 869 | const typename Collection::value_type::second_type& value) { | 366 | 869 | return InsertIfNotPresent( | 367 | 869 | collection, typename Collection::value_type(key, value)); | 368 | 869 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb5tools16YsckTabletServerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 365 | 2.86k | const typename Collection::value_type::second_type& value) { | 366 | 2.86k | return InsertIfNotPresent( | 367 | 2.86k | collection, typename Collection::value_type(key, value)); | 368 | 2.86k | } |
_Z18InsertIfNotPresentINSt3__13mapIN2yb5SliceEiNS3_10ComparatorENS0_9allocatorINS0_4pairIKS3_iEEEEEEEbPT_RKNSB_10value_type10first_typeERKNSB_10value_type11second_typeE Line | Count | Source | 365 | 3 | const typename Collection::value_type::second_type& value) { | 366 | 3 | return InsertIfNotPresent( | 367 | 3 | collection, typename Collection::value_type(key, value)); | 368 | 3 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 365 | 158k | const typename Collection::value_type::second_type& value) { | 366 | 158k | return InsertIfNotPresent( | 367 | 158k | collection, typename Collection::value_type(key, value)); | 368 | 158k | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus12ElectionVoteENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSI_10value_type10first_typeERKNSI_10value_type11second_typeE Line | Count | Source | 365 | 164k | const typename Collection::value_type::second_type& value) { | 366 | 164k | return InsertIfNotPresent( | 367 | 164k | collection, typename Collection::value_type(key, value)); | 368 | 164k | } |
_Z18InsertIfNotPresentINSt3__13mapIxN2yb9consensus8LogCache10CacheEntryENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS5_EEEEEEEbPT_RKNSE_10value_type10first_typeERKNSE_10value_type11second_typeE Line | Count | Source | 365 | 88.8k | const typename Collection::value_type::second_type& value) { | 366 | 88.8k | return InsertIfNotPresent( | 367 | 88.8k | collection, typename Collection::value_type(key, value)); | 368 | 88.8k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus10RaftPeerPBENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEbPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 365 | 113k | const typename Collection::value_type::second_type& value) { | 366 | 113k | return InsertIfNotPresent( | 367 | 113k | collection, typename Collection::value_type(key, value)); | 368 | 113k | } |
_Z18InsertIfNotPresentINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEEEbPT_RKNSG_10value_type10first_typeERKNSG_10value_type11second_typeE Line | Count | Source | 365 | 89.2k | const typename Collection::value_type::second_type& value) { | 366 | 89.2k | return InsertIfNotPresent( | 367 | 89.2k | collection, typename Collection::value_type(key, value)); | 368 | 89.2k | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10TabletInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 365 | 53.7k | const typename Collection::value_type::second_type& value) { | 366 | 53.7k | return InsertIfNotPresent( | 367 | 53.7k | collection, typename Collection::value_type(key, value)); | 368 | 53.7k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6master12TSDescriptorEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 365 | 5.53k | const typename Collection::value_type::second_type& value) { | 366 | 5.53k | return InsertIfNotPresent( | 367 | 5.53k | collection, typename Collection::value_type(key, value)); | 368 | 5.53k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6tablet10TabletPeerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEbPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 365 | 83.4k | const typename Collection::value_type::second_type& value) { | 366 | 83.4k | return InsertIfNotPresent( | 367 | 83.4k | collection, typename Collection::value_type(key, value)); | 368 | 83.4k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb7tserver15TSTabletManager17TabletReportStateENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 196k | const typename Collection::value_type::second_type& value) { | 366 | 196k | return InsertIfNotPresent( | 367 | 196k | collection, typename Collection::value_type(key, value)); | 368 | 196k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS2_10faststringEEEEENS0_4hashImEENS0_8equal_toIS3_EENS0_9allocatorINS0_4pairIKS3_S8_EEEEEEEbPT_RKNSJ_10value_type10first_typeERKNSJ_10value_type11second_typeE Line | Count | Source | 365 | 17.3k | const typename Collection::value_type::second_type& value) { | 366 | 17.3k | return InsertIfNotPresent( | 367 | 17.3k | collection, typename Collection::value_type(key, value)); | 368 | 17.3k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENS0_4hashImEENS0_8equal_toIS3_EENS9_INS0_4pairIKS3_SD_EEEEEEEbPT_RKNSN_10value_type10first_typeERKNSN_10value_type11second_typeE Line | Count | Source | 365 | 65.2k | const typename Collection::value_type::second_type& value) { | 366 | 65.2k | return InsertIfNotPresent( | 367 | 65.2k | collection, typename Collection::value_type(key, value)); | 368 | 65.2k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapI12GStringPiecemNS0_4hashIS2_EENS0_8equal_toIS2_EEN2yb20STLCountingAllocatorINS0_4pairIKS2_mEENS0_9allocatorISB_EEEEEEEbPT_RKNSG_10value_type10first_typeERKNSG_10value_type11second_typeE Line | Count | Source | 365 | 39.0M | const typename Collection::value_type::second_type& value) { | 366 | 39.0M | return InsertIfNotPresent( | 367 | 39.0M | collection, typename Collection::value_type(key, value)); | 368 | 39.0M | } |
_Z18InsertIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEbPT_RKNSF_10value_type10first_typeERKNSF_10value_type11second_typeE Line | Count | Source | 365 | 17.8k | const typename Collection::value_type::second_type& value) { | 366 | 17.8k | return InsertIfNotPresent( | 367 | 17.8k | collection, typename Collection::value_type(key, value)); | 368 | 17.8k | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIxPN2yb5debug8TraceLog13PerThreadInfoENS0_4hashIxEENS0_8equal_toIxEENS0_9allocatorINS0_4pairIKxS6_EEEEEEEbPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE Line | Count | Source | 365 | 18 | const typename Collection::value_type::second_type& value) { | 366 | 18 | return InsertIfNotPresent( | 367 | 18 | collection, typename Collection::value_type(key, value)); | 368 | 18 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 1 | const typename Collection::value_type::second_type& value) { | 366 | 1 | return InsertIfNotPresent( | 367 | 1 | collection, typename Collection::value_type(key, value)); | 368 | 1 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb8CallbackIFvRKS7_RKNS8_6StatusEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairISA_SG_EEEEEEEbPT_RKNSP_10value_type10first_typeERKNSP_10value_type11second_typeE Line | Count | Source | 365 | 1 | const typename Collection::value_type::second_type& value) { | 366 | 1 | return InsertIfNotPresent( | 367 | 1 | collection, typename Collection::value_type(key, value)); | 368 | 1 | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb15FailureDetectorEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 1 | const typename Collection::value_type::second_type& value) { | 366 | 1 | return InsertIfNotPresent( | 367 | 1 | collection, typename Collection::value_type(key, value)); | 368 | 1 | } |
_Z18InsertIfNotPresentINSt3__13mapIPKc13scoped_refptrIN2yb6MetricEENS0_4lessIS3_EENS0_9allocatorINS0_4pairIKS3_S7_EEEEEEEbPT_RKNSG_10value_type10first_typeERKNSG_10value_type11second_typeE Line | Count | Source | 365 | 80.7M | const typename Collection::value_type::second_type& value) { | 366 | 80.7M | return InsertIfNotPresent( | 367 | 80.7M | collection, typename Collection::value_type(key, value)); | 368 | 80.7M | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEbPT_RKNSJ_10value_type10first_typeERKNSJ_10value_type11second_typeE Line | Count | Source | 365 | 10.1M | const typename Collection::value_type::second_type& value) { | 366 | 10.1M | return InsertIfNotPresent( | 367 | 10.1M | collection, typename Collection::value_type(key, value)); | 368 | 10.1M | } |
_Z18InsertIfNotPresentINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb12MetricEntityEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEbPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 365 | 130k | const typename Collection::value_type::second_type& value) { | 366 | 130k | return InsertIfNotPresent( | 367 | 130k | collection, typename Collection::value_type(key, value)); | 368 | 130k | } |
|
369 | | |
370 | | // Same as above except dies if the key already exists in the collection. |
371 | | template <class Collection> |
372 | | void InsertOrDie(Collection* const collection, |
373 | 2.63M | const typename Collection::value_type& value) { |
374 | 18.4E | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; |
375 | 2.63M | } Unexecuted instantiation: _Z11InsertOrDieINSt3__13setIlNS0_4lessIlEENS0_9allocatorIlEEEEEvPT_RKNS7_10value_typeE _Z11InsertOrDieINSt3__113unordered_setIPN2yb5itest14TServerDetailsENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorIS5_EEEEEvPT_RKNSD_10value_typeE Line | Count | Source | 373 | 1 | const typename Collection::value_type& value) { | 374 | 0 | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 1 | } |
_Z11InsertOrDieINSt3__113unordered_setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_IS7_EEEEEvPT_RKNSE_10value_typeE Line | Count | Source | 373 | 439k | const typename Collection::value_type& value) { | 374 | 18.4E | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 439k | } |
_Z11InsertOrDieINSt3__13setINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_4lessIS7_EENS5_IS7_EEEEEvPT_RKNSC_10value_typeE Line | Count | Source | 373 | 82.1k | const typename Collection::value_type& value) { | 374 | 0 | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 82.1k | } |
_Z11InsertOrDieINSt3__113unordered_setIPKN6google8protobuf14FileDescriptorENS0_4hashIS6_EENS0_8equal_toIS6_EENS0_9allocatorIS6_EEEEEvPT_RKNSE_10value_typeE Line | Count | Source | 373 | 1.13M | const typename Collection::value_type& value) { | 374 | 18.4E | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 1.13M | } |
_Z11InsertOrDieINSt3__113unordered_setIPN2yb15ThreadPoolTokenENS0_4hashIS4_EENS0_8equal_toIS4_EENS0_9allocatorIS4_EEEEEvPT_RKNSC_10value_typeE Line | Count | Source | 373 | 622k | const typename Collection::value_type& value) { | 374 | 18.4E | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 622k | } |
_Z11InsertOrDieINSt3__113unordered_setIPN2yb6ThreadENS0_4hashIS4_EENS0_8equal_toIS4_EENS0_9allocatorIS4_EEEEEvPT_RKNSC_10value_typeE Line | Count | Source | 373 | 354k | const typename Collection::value_type& value) { | 374 | 42 | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value; | 375 | 354k | } |
|
376 | | |
377 | | // Same as above except doesn't log the value on error. |
378 | | template <class Collection> |
379 | | void InsertOrDieNoPrint(Collection* const collection, |
380 | | const typename Collection::value_type& value) { |
381 | | CHECK(InsertIfNotPresent(collection, value)) << "duplicate value."; |
382 | | } |
383 | | |
384 | | // Inserts the key-value pair into the collection. Dies if key was already |
385 | | // present. |
386 | | template <class Collection> |
387 | | void InsertOrDie(Collection* const collection, |
388 | | const typename Collection::value_type::first_type& key, |
389 | 92.0M | const typename Collection::value_type::second_type& data) { |
390 | 179 | CHECK(InsertIfNotPresent(collection, key, data)) |
391 | 179 | << "duplicate key: " << key; |
392 | 92.0M | } _Z11InsertOrDieINSt3__13mapIN2yb9consensus13TestPeerProxy6MethodENS0_8functionIFvvEEENS0_4lessIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEvPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE Line | Count | Source | 389 | 1.01k | const typename Collection::value_type::second_type& data) { | 390 | 1 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 1 | << "duplicate key: " << key; | 392 | 1.01k | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus9PeerProxyENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEvPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 389 | 1.69k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 1.69k | } |
_Z11InsertOrDieINSt3__113unordered_mapIPN2yb9consensus14ConsensusRoundEPNS2_12SynchronizerENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S7_EEEEEEEvPT_RKNSI_10value_type10first_typeERKNSI_10value_type11second_typeE Line | Count | Source | 389 | 172 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 172 | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb9consensus13RaftConsensusEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEvPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 389 | 23 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 23 | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb5itest14TServerDetailsENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEvPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 389 | 9 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 9 | } |
Unexecuted instantiation: _Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEvPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE _Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb6master13TabletReplicaENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEvPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 389 | 869 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 869 | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb5tools16YsckTabletServerEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEvPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 389 | 2.86k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 2.86k | } |
_Z11InsertOrDieINSt3__13mapIN2yb5SliceEiNS3_10ComparatorENS0_9allocatorINS0_4pairIKS3_iEEEEEEEvPT_RKNSB_10value_type10first_typeERKNSB_10value_type11second_typeE Line | Count | Source | 389 | 3 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 3 | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEvPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 389 | 158k | const typename Collection::value_type::second_type& data) { | 390 | 28 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 28 | << "duplicate key: " << key; | 392 | 158k | } |
_Z11InsertOrDieINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus12ElectionVoteENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEvPT_RKNSI_10value_type10first_typeERKNSI_10value_type11second_typeE Line | Count | Source | 389 | 164k | const typename Collection::value_type::second_type& data) { | 390 | 5 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 5 | << "duplicate key: " << key; | 392 | 164k | } |
_Z11InsertOrDieINSt3__13mapIxN2yb9consensus8LogCache10CacheEntryENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS5_EEEEEEEvPT_RKNSE_10value_type10first_typeERKNSE_10value_type11second_typeE Line | Count | Source | 389 | 88.7k | const typename Collection::value_type::second_type& data) { | 390 | 18.4E | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 18.4E | << "duplicate key: " << key; | 392 | 88.7k | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb9consensus10RaftPeerPBENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEEEvPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 389 | 113k | const typename Collection::value_type::second_type& data) { | 390 | 18.4E | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 18.4E | << "duplicate key: " << key; | 392 | 113k | } |
_Z11InsertOrDieINSt3__13mapIx13scoped_refptrIN2yb3log8LogIndex10IndexChunkEENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS7_EEEEEEEvPT_RKNSG_10value_type10first_typeERKNSG_10value_type11second_typeE Line | Count | Source | 389 | 89.2k | const typename Collection::value_type::second_type& data) { | 390 | 7 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 7 | << "duplicate key: " << key; | 392 | 89.2k | } |
_Z11InsertOrDieINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master10TabletInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEvPT_RKNSK_10value_type10first_typeERKNSK_10value_type11second_typeE Line | Count | Source | 389 | 53.7k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 53.7k | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10shared_ptrIN2yb6master12TSDescriptorEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEEvPT_RKNSM_10value_type10first_typeERKNSM_10value_type11second_typeE Line | Count | Source | 389 | 5.53k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 5.53k | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb7tserver15TSTabletManager17TabletReportStateENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEvPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 389 | 196k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 196k | } |
_Z11InsertOrDieINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS2_10faststringEEEEENS0_4hashImEENS0_8equal_toIS3_EENS0_9allocatorINS0_4pairIKS3_S8_EEEEEEEvPT_RKNSJ_10value_type10first_typeERKNSJ_10value_type11second_typeE Line | Count | Source | 389 | 17.3k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 17.3k | } |
_Z11InsertOrDieINSt3__113unordered_mapIN2yb8DataTypeENS0_10shared_ptrINS2_10KeyEncoderINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENS0_4hashImEENS0_8equal_toIS3_EENS9_INS0_4pairIKS3_SD_EEEEEEEvPT_RKNSN_10value_type10first_typeERKNSN_10value_type11second_typeE Line | Count | Source | 389 | 65.2k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 65.2k | } |
_Z11InsertOrDieINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEEEvPT_RKNSF_10value_type10first_typeERKNSF_10value_type11second_typeE Line | Count | Source | 389 | 17.8k | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 17.8k | } |
_Z11InsertOrDieINSt3__113unordered_mapIxPN2yb5debug8TraceLog13PerThreadInfoENS0_4hashIxEENS0_8equal_toIxEENS0_9allocatorINS0_4pairIKxS6_EEEEEEEvPT_RKNSH_10value_type10first_typeERKNSH_10value_type11second_typeE Line | Count | Source | 389 | 18 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 18 | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb8CallbackIFvRKS7_RKNS8_6StatusEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairISA_SG_EEEEEEEvPT_RKNSP_10value_type10first_typeERKNSP_10value_type11second_typeE Line | Count | Source | 389 | 1 | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 1 | } |
_Z11InsertOrDieINSt3__13mapIPKc13scoped_refptrIN2yb6MetricEENS0_4lessIS3_EENS0_9allocatorINS0_4pairIKS3_S7_EEEEEEEvPT_RKNSG_10value_type10first_typeERKNSG_10value_type11second_typeE Line | Count | Source | 389 | 80.7M | const typename Collection::value_type::second_type& data) { | 390 | 0 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 0 | << "duplicate key: " << key; | 392 | 80.7M | } |
_Z11InsertOrDieINSt3__113unordered_mapIPKN2yb15MetricPrototypeE13scoped_refptrINS2_6MetricEENS0_4hashIS5_EENS0_8equal_toIS5_EENS0_9allocatorINS0_4pairIKS5_S8_EEEEEEEvPT_RKNSJ_10value_type10first_typeERKNSJ_10value_type11second_typeE Line | Count | Source | 389 | 10.1M | const typename Collection::value_type::second_type& data) { | 390 | 191 | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 191 | << "duplicate key: " << key; | 392 | 10.1M | } |
_Z11InsertOrDieINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb12MetricEntityEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEEvPT_RKNSL_10value_type10first_typeERKNSL_10value_type11second_typeE Line | Count | Source | 389 | 130k | const typename Collection::value_type::second_type& data) { | 390 | 18.4E | CHECK(InsertIfNotPresent(collection, key, data)) | 391 | 18.4E | << "duplicate key: " << key; | 392 | 130k | } |
|
393 | | |
394 | | // Same as above except deson't log the key on error. |
395 | | template <class Collection> |
396 | | void InsertOrDieNoPrint( |
397 | | Collection* const collection, |
398 | | const typename Collection::value_type::first_type& key, |
399 | | const typename Collection::value_type::second_type& data) { |
400 | | CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key."; |
401 | | } |
402 | | |
403 | | // Inserts a new key and default-initialized value. Dies if the key was already |
404 | | // present. Returns a reference to the value. Example usage: |
405 | | // |
406 | | // map<int, SomeProto> m; |
407 | | // SomeProto& proto = InsertKeyOrDie(&m, 3); |
408 | | // proto.set_field("foo"); |
409 | | template <class Collection> |
410 | | typename Collection::value_type::second_type& InsertKeyOrDie( |
411 | | Collection* const collection, |
412 | | const typename Collection::value_type::first_type& key) { |
413 | | typedef typename Collection::value_type value_type; |
414 | | pair<typename Collection::iterator, bool> res = |
415 | | collection->insert(value_type(key, typename value_type::second_type())); |
416 | | CHECK(res.second) << "duplicate key: " << key; |
417 | | return res.first->second; |
418 | | } |
419 | | |
420 | | // |
421 | | // Emplace*() |
422 | | // |
423 | | template <class Collection, class... Args> |
424 | | bool EmplaceIfNotPresent(Collection* const collection, |
425 | 7.91M | Args&&... args) { |
426 | 7.91M | return collection->emplace(std::forward<Args>(args)...).second; |
427 | 7.91M | } _Z19EmplaceIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEJRA2_KcSB_EEbPT_DpOT0_ Line | Count | Source | 425 | 1 | Args&&... args) { | 426 | 1 | return collection->emplace(std::forward<Args>(args)...).second; | 427 | 1 | } |
_Z19EmplaceIfNotPresentINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEJRA2_KcDnEEbPT_DpOT0_ Line | Count | Source | 425 | 1 | Args&&... args) { | 426 | 1 | return collection->emplace(std::forward<Args>(args)...).second; | 427 | 1 | } |
_Z19EmplaceIfNotPresentINSt3__13mapIxN2yb9consensus8LogCache10CacheEntryENS0_4lessIxEENS0_9allocatorINS0_4pairIKxS5_EEEEEEJRxS5_EEbPT_DpOT0_ Line | Count | Source | 425 | 7.91M | Args&&... args) { | 426 | 7.91M | return collection->emplace(std::forward<Args>(args)...).second; | 427 | 7.91M | } |
|
428 | | |
429 | | template <class Collection, class... Args> |
430 | | void EmplaceOrDie(Collection* const collection, |
431 | 7.91M | Args&&... args) { |
432 | 18.4E | CHECK(EmplaceIfNotPresent(collection, std::forward<Args>(args)...)) |
433 | 18.4E | << "duplicate value"; |
434 | 7.91M | } |
435 | | |
436 | | // |
437 | | // Lookup*() |
438 | | // |
439 | | |
440 | | // Looks up a given key and value pair in a collection and inserts the key-value |
441 | | // pair if it's not already present. Returns a reference to the value associated |
442 | | // with the key. |
443 | | template <class Collection> |
444 | | typename Collection::value_type::second_type& |
445 | | LookupOrInsert(Collection* const collection, |
446 | 4.19k | const typename Collection::value_type& vt) { |
447 | 4.19k | return collection->insert(vt).first->second; |
448 | 4.19k | } |
449 | | |
450 | | // Same as above except the key-value are passed separately. |
451 | | template <class Collection> |
452 | | typename Collection::value_type::second_type& |
453 | | LookupOrInsert(Collection* const collection, |
454 | | const typename Collection::value_type::first_type& key, |
455 | 4.19k | const typename Collection::value_type::second_type& value) { |
456 | 4.19k | return LookupOrInsert( |
457 | 4.19k | collection, typename Collection::value_type(key, value)); |
458 | 4.19k | } |
459 | | |
460 | | // Counts the number of equivalent elements in the given "sequence", and stores |
461 | | // the results in "count_map" with element as the key and count as the value. |
462 | | // |
463 | | // Example: |
464 | | // vector<string> v = {"a", "b", "c", "a", "b"}; |
465 | | // map<string, int> m; |
466 | | // AddTokenCounts(v, 1, &m); |
467 | | // assert(m["a"] == 2); |
468 | | // assert(m["b"] == 2); |
469 | | // assert(m["c"] == 1); |
470 | | template <typename Sequence, typename Collection> |
471 | | void AddTokenCounts( |
472 | | const Sequence& sequence, |
473 | | const typename Collection::value_type::second_type& increment, |
474 | | Collection* const count_map) { |
475 | | for (typename Sequence::const_iterator it = sequence.begin(); |
476 | | it != sequence.end(); ++it) { |
477 | | typename Collection::value_type::second_type& value = |
478 | | LookupOrInsert(count_map, *it, |
479 | | typename Collection::value_type::second_type()); |
480 | | value += increment; |
481 | | } |
482 | | } |
483 | | |
484 | | // Helpers for LookupOrInsertNew(), needed to create a new value type when the |
485 | | // type itself is a pointer, i.e., these extract the actual type from a pointer. |
486 | | template <class T> |
487 | | void MapUtilAssignNewDefaultInstance(T** location) { |
488 | | *location = new T(); |
489 | | } |
490 | | |
491 | | template <class T, class Arg> |
492 | | void MapUtilAssignNewInstance(T** location, const Arg &arg) { |
493 | | *location = new T(arg); |
494 | | } |
495 | | |
496 | | // Returns a reference to the value associated with key. If not found, a value |
497 | | // is default constructed on the heap and added to the map. |
498 | | // |
499 | | // This function is useful for containers of the form map<Key, Value*>, where |
500 | | // inserting a new key, value pair involves constructing a new heap-allocated |
501 | | // Value, and storing a pointer to that in the collection. |
502 | | template <class Collection> |
503 | | typename Collection::value_type::second_type& |
504 | | LookupOrInsertNew(Collection* const collection, |
505 | | const typename Collection::value_type::first_type& key) { |
506 | | pair<typename Collection::iterator, bool> ret = |
507 | | collection->insert( |
508 | | typename Collection::value_type(key, |
509 | | static_cast<typename Collection::value_type::second_type>(NULL))); |
510 | | if (ret.second) { |
511 | | // This helper is needed to 'extract' the Value type from the type of the |
512 | | // container value, which is (Value*). |
513 | | MapUtilAssignNewDefaultInstance(&(ret.first->second)); |
514 | | } |
515 | | return ret.first->second; |
516 | | } |
517 | | |
518 | | // Same as above but constructs the value using the single-argument constructor |
519 | | // and the given "arg". |
520 | | template <class Collection, class Arg> |
521 | | typename Collection::value_type::second_type& |
522 | | LookupOrInsertNew(Collection* const collection, |
523 | | const typename Collection::value_type::first_type& key, |
524 | | const Arg& arg) { |
525 | | pair<typename Collection::iterator, bool> ret = |
526 | | collection->insert( |
527 | | typename Collection::value_type( |
528 | | key, |
529 | | static_cast<typename Collection::value_type::second_type>(NULL))); |
530 | | if (ret.second) { |
531 | | // This helper is needed to 'extract' the Value type from the type of the |
532 | | // container value, which is (Value*). |
533 | | MapUtilAssignNewInstance(&(ret.first->second), arg); |
534 | | } |
535 | | return ret.first->second; |
536 | | } |
537 | | |
538 | | // Lookup of linked/shared pointers is used in two scenarios: |
539 | | // |
540 | | // Use LookupOrInsertSharedPtr if the container does not own the elements |
541 | | // for their whole lifetime. This is typically the case when a reader allows |
542 | | // parallel updates to the container. In this case a Mutex only needs to lock |
543 | | // container operations, but all element operations must be performed on the |
544 | | // shared pointer. Finding an element must be performed using FindPtr*() and |
545 | | // cannot be done with FindLinkedPtr*() even though it compiles. |
546 | | |
547 | | // Lookup a key in a map or hash_map whose values are shared_ptrs. If it is |
548 | | // missing, set collection[key].reset(new Value::element_type). Unlike |
549 | | // LookupOrInsertNewLinkedPtr, this function returns the shared_ptr instead of |
550 | | // the raw pointer. Value::element_type must be default constructable. |
551 | | template <class Collection> |
552 | | typename Collection::value_type::second_type& |
553 | | LookupOrInsertNewSharedPtr( |
554 | | Collection* const collection, |
555 | | const typename Collection::value_type::first_type& key) { |
556 | | typedef typename Collection::value_type::second_type SharedPtr; |
557 | | typedef typename Collection::value_type::second_type::element_type Element; |
558 | | pair<typename Collection::iterator, bool> ret = |
559 | | collection->insert(typename Collection::value_type(key, SharedPtr())); |
560 | | if (ret.second) { |
561 | | ret.first->second.reset(new Element()); |
562 | | } |
563 | | return ret.first->second; |
564 | | } |
565 | | |
566 | | // A variant of LookupOrInsertNewSharedPtr where the value is constructed using |
567 | | // a single-parameter constructor. Note: the constructor argument is computed |
568 | | // even if it will not be used, so only values cheap to compute should be passed |
569 | | // here. On the other hand it does not matter how expensive the construction of |
570 | | // the actual stored value is, as that only occurs if necessary. |
571 | | template <class Collection, class Arg> |
572 | | typename Collection::value_type::second_type& |
573 | | LookupOrInsertNewSharedPtr( |
574 | | Collection* const collection, |
575 | | const typename Collection::value_type::first_type& key, |
576 | 4.19k | const Arg& arg) { |
577 | 4.19k | typedef typename Collection::value_type::second_type SharedPtr; |
578 | 4.19k | typedef typename Collection::value_type::second_type::element_type Element; |
579 | 4.19k | pair<typename Collection::iterator, bool> ret = |
580 | 4.19k | collection->insert(typename Collection::value_type(key, SharedPtr())); |
581 | 4.19k | if (ret.second) { |
582 | 1.87k | ret.first->second.reset(new Element(arg)); |
583 | 1.87k | } |
584 | 4.19k | return ret.first->second; |
585 | 4.19k | } |
586 | | |
587 | | // |
588 | | // Misc Utility Functions |
589 | | // |
590 | | |
591 | | // Updates the value associated with the given key. If the key was not already |
592 | | // present, then the key-value pair are inserted and "previous" is unchanged. If |
593 | | // the key was already present, the value is updated and "*previous" will |
594 | | // contain a copy of the old value. |
595 | | // |
596 | | // InsertOrReturnExisting has complementary behavior that returns the |
597 | | // address of an already existing value, rather than updating it. |
598 | | template <class Collection> |
599 | | bool UpdateReturnCopy(Collection* const collection, |
600 | | const typename Collection::value_type::first_type& key, |
601 | | const typename Collection::value_type::second_type& value, |
602 | | typename Collection::value_type::second_type* previous) { |
603 | | pair<typename Collection::iterator, bool> ret = |
604 | | collection->insert(typename Collection::value_type(key, value)); |
605 | | if (!ret.second) { |
606 | | // update |
607 | | if (previous) { |
608 | | *previous = ret.first->second; |
609 | | } |
610 | | ret.first->second = value; |
611 | | return true; |
612 | | } |
613 | | return false; |
614 | | } |
615 | | |
616 | | // Same as above except that the key and value are passed as a pair. |
617 | | template <class Collection> |
618 | | bool UpdateReturnCopy(Collection* const collection, |
619 | | const typename Collection::value_type& vt, |
620 | | typename Collection::value_type::second_type* previous) { |
621 | | pair<typename Collection::iterator, bool> ret = |
622 | | collection->insert(vt); |
623 | | if (!ret.second) { |
624 | | // update |
625 | | if (previous) { |
626 | | *previous = ret.first->second; |
627 | | } |
628 | | ret.first->second = vt.second; |
629 | | return true; |
630 | | } |
631 | | return false; |
632 | | } |
633 | | |
634 | | // Tries to insert the given key-value pair into the collection. Returns NULL if |
635 | | // the insert succeeds. Otherwise, returns a pointer to the existing value. |
636 | | // |
637 | | // This complements UpdateReturnCopy in that it allows to update only after |
638 | | // verifying the old value and still insert quickly without having to look up |
639 | | // twice. Unlike UpdateReturnCopy this also does not come with the issue of an |
640 | | // undefined previous* in case new data was inserted. |
641 | | template <class Collection> |
642 | | typename Collection::value_type::second_type* |
643 | | InsertOrReturnExisting(Collection* const collection, |
644 | | const typename Collection::value_type& vt) { |
645 | | pair<typename Collection::iterator, bool> ret = collection->insert(vt); |
646 | | if (ret.second) { |
647 | | return NULL; // Inserted, no existing previous value. |
648 | | } else { |
649 | | return &ret.first->second; // Return address of already existing value. |
650 | | } |
651 | | } |
652 | | |
653 | | // Same as above, except for explicit key and data. |
654 | | template <class Collection> |
655 | | typename Collection::value_type::second_type* |
656 | | InsertOrReturnExisting( |
657 | | Collection* const collection, |
658 | | const typename Collection::value_type::first_type& key, |
659 | | const typename Collection::value_type::second_type& data) { |
660 | | return InsertOrReturnExisting(collection, |
661 | | typename Collection::value_type(key, data)); |
662 | | } |
663 | | |
664 | | // Saves the reverse mapping into reverse. Key/value pairs are inserted in the |
665 | | // order the iterator returns them. |
666 | | template <class Collection, class ReverseCollection> |
667 | | void ReverseMap(const Collection& collection, |
668 | | ReverseCollection* const reverse) { |
669 | | CHECK(reverse != NULL); |
670 | | for (typename Collection::const_iterator it = collection.begin(); |
671 | | it != collection.end(); |
672 | | ++it) { |
673 | | InsertOrUpdate(reverse, it->second, it->first); |
674 | | } |
675 | | } |
676 | | |
677 | | // Erases the collection item identified by the given key, and returns the value |
678 | | // associated with that key. It is assumed that the value (i.e., the |
679 | | // mapped_type) is a pointer. Returns NULL if the key was not found in the |
680 | | // collection. |
681 | | // |
682 | | // Examples: |
683 | | // map<string, MyType*> my_map; |
684 | | // |
685 | | // One line cleanup: |
686 | | // delete EraseKeyReturnValuePtr(&my_map, "abc"); |
687 | | // |
688 | | // Use returned value: |
689 | | // std::unique_ptr<MyType> value_ptr(EraseKeyReturnValuePtr(&my_map, "abc")); |
690 | | // if (value_ptr.get()) |
691 | | // value_ptr->DoSomething(); |
692 | | // |
693 | | template <class Collection> |
694 | | typename Collection::value_type::second_type EraseKeyReturnValuePtr( |
695 | | Collection* const collection, |
696 | 43.2k | const typename Collection::value_type::first_type& key) { |
697 | 43.2k | auto it = collection->find(key); |
698 | 43.2k | if (it == collection->end()) { |
699 | 0 | return NULL; |
700 | 0 | } |
701 | 43.2k | typename Collection::value_type::second_type v = it->second; |
702 | 43.2k | collection->erase(it); |
703 | 43.2k | return v; |
704 | 43.2k | } _Z22EraseKeyReturnValuePtrINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb9consensus16PeerMessageQueue11TrackedPeerENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SC_EEEEEEENT_10value_type11second_typeEPSM_RKNSM_10value_type10first_typeE Line | Count | Source | 696 | 43.2k | const typename Collection::value_type::first_type& key) { | 697 | 43.2k | auto it = collection->find(key); | 698 | 43.2k | if (it == collection->end()) { | 699 | 0 | return NULL; | 700 | 0 | } | 701 | 43.2k | typename Collection::value_type::second_type v = it->second; | 702 | 43.2k | collection->erase(it); | 703 | 43.2k | return v; | 704 | 43.2k | } |
_Z22EraseKeyReturnValuePtrINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN2yb20TimedFailureDetector4NodeENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SB_EEEEEEENT_10value_type11second_typeEPSL_RKNSL_10value_type10first_typeE Line | Count | Source | 696 | 1 | const typename Collection::value_type::first_type& key) { | 697 | 1 | auto it = collection->find(key); | 698 | 1 | if (it == collection->end()) { | 699 | 0 | return NULL; | 700 | 0 | } | 701 | 1 | typename Collection::value_type::second_type v = it->second; | 702 | 1 | collection->erase(it); | 703 | 1 | return v; | 704 | 1 | } |
|
705 | | |
706 | | // Inserts all the keys from map_container into key_container, which must |
707 | | // support insert(MapContainer::key_type). |
708 | | // |
709 | | // Note: any initial contents of the key_container are not cleared. |
710 | | template <class MapContainer, class KeyContainer> |
711 | | void InsertKeysFromMap(const MapContainer& map_container, |
712 | | KeyContainer* key_container) { |
713 | | CHECK(key_container != NULL); |
714 | | for (typename MapContainer::const_iterator it = map_container.begin(); |
715 | | it != map_container.end(); ++it) { |
716 | | key_container->insert(it->first); |
717 | | } |
718 | | } |
719 | | |
720 | | // Appends all the keys from map_container into key_container, which must |
721 | | // support push_back(MapContainer::key_type). |
722 | | // |
723 | | // Note: any initial contents of the key_container are not cleared. |
724 | | template <class MapContainer, class KeyContainer> |
725 | | void AppendKeysFromMap(const MapContainer& map_container, |
726 | | KeyContainer* key_container) { |
727 | | CHECK(key_container != NULL); |
728 | | for (typename MapContainer::const_iterator it = map_container.begin(); |
729 | | it != map_container.end(); ++it) { |
730 | | key_container->push_back(it->first); |
731 | | } |
732 | | } |
733 | | |
734 | | // A more specialized overload of AppendKeysFromMap to optimize reallocations |
735 | | // for the common case in which we're appending keys to a vector and hence can |
736 | | // (and sometimes should) call reserve() first. |
737 | | // |
738 | | // (It would be possible to play SFINAE games to call reserve() for any |
739 | | // container that supports it, but this seems to get us 99% of what we need |
740 | | // without the complexity of a SFINAE-based solution.) |
741 | | template <class MapContainer, class KeyType> |
742 | | void AppendKeysFromMap(const MapContainer& map_container, |
743 | | vector<KeyType>* key_container) { |
744 | | CHECK(key_container != NULL); |
745 | | // We now have the opportunity to call reserve(). Calling reserve() every |
746 | | // time is a bad idea for some use cases: libstdc++'s implementation of |
747 | | // vector<>::reserve() resizes the vector's backing store to exactly the |
748 | | // given size (unless it's already at least that big). Because of this, |
749 | | // the use case that involves appending a lot of small maps (total size |
750 | | // N) one by one to a vector would be O(N^2). But never calling reserve() |
751 | | // loses the opportunity to improve the use case of adding from a large |
752 | | // map to an empty vector (this improves performance by up to 33%). A |
753 | | // number of heuristics are possible; see the discussion in |
754 | | // cl/34081696. Here we use the simplest one. |
755 | | if (key_container->empty()) { |
756 | | key_container->reserve(map_container.size()); |
757 | | } |
758 | | for (typename MapContainer::const_iterator it = map_container.begin(); |
759 | | it != map_container.end(); ++it) { |
760 | | key_container->push_back(it->first); |
761 | | } |
762 | | } |
763 | | |
764 | | // Inserts all the values from map_container into value_container, which must |
765 | | // support push_back(MapContainer::mapped_type). |
766 | | // |
767 | | // Note: any initial contents of the value_container are not cleared. |
768 | | template <class MapContainer, class ValueContainer> |
769 | | void AppendValuesFromMap(const MapContainer& map_container, |
770 | | ValueContainer* value_container) { |
771 | | CHECK(value_container != NULL); |
772 | | for (typename MapContainer::const_iterator it = map_container.begin(); |
773 | | it != map_container.end(); ++it) { |
774 | | value_container->push_back(it->second); |
775 | | } |
776 | | } |
777 | | |
778 | | // A more specialized overload of AppendValuesFromMap to optimize reallocations |
779 | | // for the common case in which we're appending values to a vector and hence |
780 | | // can (and sometimes should) call reserve() first. |
781 | | // |
782 | | // (It would be possible to play SFINAE games to call reserve() for any |
783 | | // container that supports it, but this seems to get us 99% of what we need |
784 | | // without the complexity of a SFINAE-based solution.) |
785 | | template <class MapContainer, class ValueType> |
786 | | void AppendValuesFromMap(const MapContainer& map_container, |
787 | 2.10k | vector<ValueType>* value_container) { |
788 | 2.10k | CHECK(value_container != NULL); |
789 | | // See AppendKeysFromMap for why this is done. |
790 | 2.10k | if (value_container->empty()) { |
791 | 2.10k | value_container->reserve(map_container.size()); |
792 | 2.10k | } |
793 | 1.86k | for (const auto& entry : map_container) { |
794 | 1.86k | value_container->push_back(entry.second); |
795 | 1.86k | } |
796 | 2.10k | } _Z19AppendValuesFromMapINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE13scoped_refptrIN2yb6master9TableInfoEENS0_4lessIS7_EENS5_INS0_4pairIKS7_SC_EEEEEESC_EvRKT_PNS0_6vectorIT0_NS5_ISO_EEEE Line | Count | Source | 787 | 2.10k | vector<ValueType>* value_container) { | 788 | 2.10k | CHECK(value_container != NULL); | 789 | | // See AppendKeysFromMap for why this is done. | 790 | 2.10k | if (value_container->empty()) { | 791 | 2.10k | value_container->reserve(map_container.size()); | 792 | 2.10k | } | 793 | 1.85k | for (const auto& entry : map_container) { | 794 | 1.85k | value_container->push_back(entry.second); | 795 | 1.85k | } | 796 | 2.10k | } |
_Z19AppendValuesFromMapINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEN2yb6master13TabletReplicaENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SA_EEEEEESA_EvRKT_PNS0_6vectorIT0_NS5_ISO_EEEE Line | Count | Source | 787 | 3 | vector<ValueType>* value_container) { | 788 | 3 | CHECK(value_container != NULL); | 789 | | // See AppendKeysFromMap for why this is done. | 790 | 3 | if (value_container->empty()) { | 791 | 3 | value_container->reserve(map_container.size()); | 792 | 3 | } | 793 | 9 | for (const auto& entry : map_container) { | 794 | 9 | value_container->push_back(entry.second); | 795 | 9 | } | 796 | 3 | } |
|
797 | | |
798 | | #endif // YB_GUTIL_MAP_UTIL_H |