Left: | ||
Right: |
OLD | NEW |
---|---|
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 Loading... | |
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 | |
56 StringSetEntry(key_type_cref key = key_type()) | 59 StringSetEntry(key_type_cref key = key_type()) |
57 { | 60 { |
58 if (!key.is_invalid()) | 61 if (!key.is_invalid()) |
59 first.reset(key); | 62 first.reset(key); |
60 } | 63 } |
61 | 64 |
62 bool equals(key_type_cref other) const | 65 bool equals(key_type_cref other) const |
63 { | 66 { |
64 return first.equals(other); | 67 return first.equals(other); |
65 } | 68 } |
(...skipping 20 matching lines...) Expand all Loading... | |
86 }; | 89 }; |
87 | 90 |
88 template<typename Key, typename Value> | 91 template<typename Key, typename Value> |
89 struct StringMapEntry : StringSetEntry<Key> | 92 struct StringMapEntry : StringSetEntry<Key> |
90 { | 93 { |
91 typedef StringSetEntry<Key> super; | 94 typedef StringSetEntry<Key> super; |
92 typedef Value value_type; | 95 typedef Value value_type; |
93 | 96 |
94 value_type second; | 97 value_type second; |
95 | 98 |
99 StringMapEntry& operator=(const StringMapEntry&) = default; | |
100 StringMapEntry& operator=(StringMapEntry&&) = default; | |
101 | |
96 StringMapEntry(typename super::key_type_cref key = Key(), | 102 StringMapEntry(typename super::key_type_cref key = Key(), |
97 value_type value = value_type()) | 103 value_type value = value_type()) |
98 : super(key), second(value) | 104 : super(key), second(std::move(value)) |
99 { | 105 { |
100 } | 106 } |
101 | 107 |
102 void erase() | 108 void erase() |
103 { | 109 { |
104 super::erase(); | 110 super::erase(); |
105 second = value_type(); | 111 second = value_type(); |
106 } | 112 } |
107 }; | 113 }; |
108 } | 114 } |
109 | 115 |
110 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>; | 116 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>; |
111 | 117 |
112 template<typename Value> | 118 template<typename Value> |
113 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value> >; | 119 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value> >; |
114 template<typename Value> | 120 template<typename Value> |
115 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value >>; | 121 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value >>; |
OLD | NEW |