| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_MULTI_HASHSET_H_ | 5 #ifndef SRC_VM_MULTI_HASHSET_H_ |
| 6 #define SRC_VM_MULTI_HASHSET_H_ | 6 #define SRC_VM_MULTI_HASHSET_H_ |
| 7 | 7 |
| 8 #include "src/vm/hash_map.h" | 8 #include "src/vm/hash_map.h" |
| 9 | 9 |
| 10 namespace fletch { | 10 namespace dartino { |
| 11 | 11 |
| 12 // MultiHashSet: | 12 // MultiHashSet: |
| 13 // Interface is kept as close as possible to std::unordered_map, but: | 13 // Interface is kept as close as possible to std::unordered_map, but: |
| 14 // * Only functions that can be expected to be tiny are inlined. | 14 // * Only functions that can be expected to be tiny are inlined. |
| 15 // * The Key type must be memcpy-able and castable to void* and the same size. | 15 // * The Key type must be memcpy-able and castable to void* and the same size. |
| 16 // * The hash code is just a cast to int. | 16 // * The hash code is just a cast to int. |
| 17 // * Not all methods are implemented. | 17 // * Not all methods are implemented. |
| 18 // * Iterators are invalidated on all inserts, even if the key was already | 18 // * Iterators are invalidated on all inserts, even if the key was already |
| 19 // present. | 19 // present. |
| 20 // * Google naming conventions are used (CamelCase classes and methods). | 20 // * Google naming conventions are used (CamelCase classes and methods). |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 if (it->second > 1) { | 47 if (it->second > 1) { |
| 48 it->second -= 1; | 48 it->second -= 1; |
| 49 return false; | 49 return false; |
| 50 } | 50 } |
| 51 | 51 |
| 52 this->Erase(it); | 52 this->Erase(it); |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace fletch | 57 } // namespace dartino |
| 58 | 58 |
| 59 #endif // SRC_VM_MULTI_HASHSET_H_ | 59 #endif // SRC_VM_MULTI_HASHSET_H_ |
| OLD | NEW |