Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: src/vm/hash_set.h

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/vm/hash_map.h ('k') | src/vm/hash_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HASH_SET_H_ 5 #ifndef SRC_VM_HASH_SET_H_
6 #define SRC_VM_HASH_SET_H_ 6 #define SRC_VM_HASH_SET_H_
7 7
8 #include "src/vm/hash_table.h" 8 #include "src/vm/hash_table.h"
9 9
10 namespace fletch { 10 namespace dartino {
11 11
12 template <typename Key> 12 template <typename Key>
13 struct SetKeyExtractor { 13 struct SetKeyExtractor {
14 static Key& GetKey(Key& key) { // NOLINT 14 static Key& GetKey(Key& key) { // NOLINT
15 return key; 15 return key;
16 } 16 }
17 17
18 static const Key& GetKey(const Key& key) { return key; } 18 static const Key& GetKey(const Key& key) { return key; }
19 }; 19 };
20 20
21 // UnorderedSet: 21 // UnorderedSet:
22 // Interface is kept as close as possible to std::unordered_map, but: 22 // Interface is kept as close as possible to std::unordered_map, but:
23 // * Only functions that can be expected to be tiny are inlined. 23 // * Only functions that can be expected to be tiny are inlined.
24 // * The Key type must be memcpy-able and castable to void* and the same size. 24 // * The Key type must be memcpy-able and castable to void* and the same size.
25 // * The hash code is just a cast to int. 25 // * The hash code is just a cast to int.
26 // * Not all methods are implemented. 26 // * Not all methods are implemented.
27 // * Iterators are invalidated on all inserts, even if the key was already 27 // * Iterators are invalidated on all inserts, even if the key was already
28 // present. 28 // present.
29 // * Google naming conventions are used (CamelCase classes and methods). 29 // * Google naming conventions are used (CamelCase classes and methods).
30 template <typename Key> 30 template <typename Key>
31 class HashSet : public UnorderedHashTable<Key, Key, SetKeyExtractor<Key>> {}; 31 class HashSet : public UnorderedHashTable<Key, Key, SetKeyExtractor<Key>> {};
32 32
33 } // namespace fletch 33 } // namespace dartino
34 34
35 #endif // SRC_VM_HASH_SET_H_ 35 #endif // SRC_VM_HASH_SET_H_
OLDNEW
« no previous file with comments | « src/vm/hash_map.h ('k') | src/vm/hash_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698