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

Delta Between Two Patch Sets: compiled/StringMap.h

Issue 29572731: Issue 5141 - Generalize Map class to allow non-strings as keys (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Introduced key_type_cref Created Dec. 4, 2017, 1:43 p.m.
Right Patch Set: Addressed remaining nits Created Dec. 4, 2017, 6:28 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 14 matching lines...) Expand all
25 namespace StringMap_internal 25 namespace StringMap_internal
26 { 26 {
27 struct StringSetEntry 27 struct StringSetEntry
28 { 28 {
29 typedef DependentString key_type; 29 typedef DependentString key_type;
30 typedef const String& key_type_cref; 30 typedef const String& key_type_cref;
31 typedef size_t size_type; 31 typedef size_t size_type;
32 32
33 key_type first; 33 key_type first;
34 34
35 StringSetEntry(key_type_cref key = DependentString()) 35 StringSetEntry(key_type_cref key = key_type())
sergei 2017/12/04 14:26:09 here and below the default value for `key` could b
Wladimir Palant 2017/12/04 18:28:48 It's non-trivial to initialize that static member,
36 { 36 {
37 if (!key.is_invalid()) 37 if (!key.is_invalid())
38 first.reset(key); 38 first.reset(key);
39 } 39 }
40 40
41 bool equals(key_type_cref other) const 41 bool equals(key_type_cref other) const
42 { 42 {
43 return first.equals(other); 43 return first.equals(other);
44 } 44 }
45 45
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 super::erase(); 87 super::erase();
88 second = value_type(); 88 second = value_type();
89 } 89 }
90 }; 90 };
91 } 91 }
92 92
93 using StringSet = Set<StringMap_internal::StringSetEntry>; 93 using StringSet = Set<StringMap_internal::StringSetEntry>;
94 94
95 template<typename Value> 95 template<typename Value>
96 using StringMap = Map<StringMap_internal::StringMapEntry<Value>>; 96 using StringMap = Map<StringMap_internal::StringMapEntry<Value>>;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld