Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compiled/StringMap.h

Issue 29677755: Issue 6279 - Make HashContainer movable and optimize resizing by moving entries. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Forgot IntMap. Remove changes not needed. Minor fix. Created Jan. 24, 2018, 3:10 a.m.
Right Patch Set: remove more unused ctor Created Jan. 25, 2018, 3:10 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/Map.h ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 template<typename Key, 46 template<typename Key,
47 class = typename std::enable_if<std::is_base_of<String, Key>::value>::type> 47 class = typename std::enable_if<std::is_base_of<String, Key>::value>::type>
48 struct StringSetEntry 48 struct StringSetEntry
49 { 49 {
50 typedef Key key_type; 50 typedef Key key_type;
51 typedef const String& key_type_cref; 51 typedef const String& key_type_cref;
52 typedef size_t size_type; 52 typedef size_t size_type;
53 53
54 key_type first; 54 key_type first;
55 55
56 StringSetEntry& operator=(const StringSetEntry&) = default;
57 StringSetEntry& operator=(StringSetEntry&&) = default;
sergei 2018/01/24 18:37:12 It seems it's actually not required here and in St
hub 2018/01/24 19:32:01 ah right. Done
sergei 2018/01/25 10:55:07 Could you please also do it for StringMapEntry bel
hub 2018/01/25 15:11:11 Done. (I was convinced they were needed, must hav
58
59 StringSetEntry(key_type_cref key = key_type()) 56 StringSetEntry(key_type_cref key = key_type())
60 { 57 {
61 if (!key.is_invalid()) 58 if (!key.is_invalid())
62 first.reset(key); 59 first.reset(key);
63 } 60 }
64 61
65 bool equals(key_type_cref other) const 62 bool equals(key_type_cref other) const
66 { 63 {
67 return first.equals(other); 64 return first.equals(other);
68 } 65 }
(...skipping 20 matching lines...) Expand all
89 }; 86 };
90 87
91 template<typename Key, typename Value> 88 template<typename Key, typename Value>
92 struct StringMapEntry : StringSetEntry<Key> 89 struct StringMapEntry : StringSetEntry<Key>
93 { 90 {
94 typedef StringSetEntry<Key> super; 91 typedef StringSetEntry<Key> super;
95 typedef Value value_type; 92 typedef Value value_type;
96 93
97 value_type second; 94 value_type second;
98 95
99 StringMapEntry& operator=(const StringMapEntry&) = default;
100 StringMapEntry& operator=(StringMapEntry&&) = default;
101
102 StringMapEntry(typename super::key_type_cref key = Key(), 96 StringMapEntry(typename super::key_type_cref key = Key(),
103 value_type value = value_type()) 97 value_type value = value_type())
104 : super(key), second(std::move(value)) 98 : super(key), second(std::move(value))
105 { 99 {
106 } 100 }
107 101
108 void erase() 102 void erase()
109 { 103 {
110 super::erase(); 104 super::erase();
111 second = value_type(); 105 second = value_type();
112 } 106 }
113 }; 107 };
114 } 108 }
115 109
116 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>; 110 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>;
117 111
118 template<typename Value> 112 template<typename Value>
119 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value> >; 113 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value> >;
120 template<typename Value> 114 template<typename Value>
121 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value >>; 115 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value >>;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld