We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f1d86d commit c546dc6Copy full SHA for c546dc6
avl_array.h
@@ -279,12 +279,18 @@ class avl_array
279
*/
280
inline bool find(const key_type& key, value_type& val) const
281
{
282
- for (size_type i = root_; i != INVALID_IDX; i = (key < key_[i]) ? child_[i].left : child_[i].right) {
283
- if (key == key_[i]) {
+ for (size_type i = root_; i != INVALID_IDX;) {
+ if (key < key_[i]) {
284
+ i = child_[i].left;
285
+ }
286
+ else if (key == key_[i]) {
287
// found key
288
val = val_[i];
289
return true;
290
}
291
+ else {
292
+ i = child_[i].right;
293
294
295
// key not found
296
return false;
0 commit comments