diff options
author | Jacek Antonelli | 2008-08-15 23:45:02 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:02 -0500 |
commit | d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd (patch) | |
tree | 7ed0c2c27d717801238a2e6b5749cd5bf88c3059 /linden/indra/llcommon/lldarray.h | |
parent | Second Life viewer sources 1.17.3.0 (diff) | |
download | meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.zip meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.gz meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.bz2 meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.xz |
Second Life viewer sources 1.18.0.6
Diffstat (limited to 'linden/indra/llcommon/lldarray.h')
-rw-r--r-- | linden/indra/llcommon/lldarray.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/linden/indra/llcommon/lldarray.h b/linden/indra/llcommon/lldarray.h index 291da19..7942e77 100644 --- a/linden/indra/llcommon/lldarray.h +++ b/linden/indra/llcommon/lldarray.h | |||
@@ -189,16 +189,17 @@ public: | |||
189 | 189 | ||
190 | void reset() { mVector.resize(0); mIndexMap.resize(0); } | 190 | void reset() { mVector.resize(0); mIndexMap.resize(0); } |
191 | bool empty() const { return mVector.empty(); } | 191 | bool empty() const { return mVector.empty(); } |
192 | size_type size() const { return mVector.empty(); } | 192 | size_type size() const { return mVector.size(); } |
193 | 193 | ||
194 | Type& operator[](const Key& k) | 194 | Type& operator[](const Key& k) |
195 | { | 195 | { |
196 | typename std::map<Key, U32>::iterator iter = mIndexMap.find(k); | 196 | typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); |
197 | if (iter == mIndexMap.end()) | 197 | if (iter == mIndexMap.end()) |
198 | { | 198 | { |
199 | U32 n = mVector.size(); | 199 | U32 n = mVector.size(); |
200 | mIndexMap[k] = n; | 200 | mIndexMap[k] = n; |
201 | mVector.resize(n+1); | 201 | mVector.resize(n+1); |
202 | llassert(mVector.size() == mIndexMap.size()); | ||
202 | return mVector[n]; | 203 | return mVector[n]; |
203 | } | 204 | } |
204 | else | 205 | else |
@@ -206,7 +207,19 @@ public: | |||
206 | return mVector[iter->second]; | 207 | return mVector[iter->second]; |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
211 | const_iterator find(const Key& k) const | ||
212 | { | ||
213 | typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); | ||
214 | if(iter == mIndexMap.end()) | ||
215 | { | ||
216 | return mVector.end(); | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | return mVector.begin() + iter->second; | ||
221 | } | ||
222 | } | ||
210 | }; | 223 | }; |
211 | 224 | ||
212 | #endif | 225 | #endif |