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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 friend class StringMap_internal::StringMapEntryReference<T>; | 317 friend class StringMap_internal::StringMapEntryReference<T>; |
318 | 318 |
319 explicit StringMap(size_type expectedEntries = 0) | 319 explicit StringMap(size_type expectedEntries = 0) |
320 : super(expectedEntries) | 320 : super(expectedEntries) |
321 { | 321 { |
322 } | 322 } |
323 | 323 |
324 StringMap(std::initializer_list<entry_type> list) | 324 StringMap(std::initializer_list<entry_type> list) |
325 : super(list.size()) | 325 : super(list.size()) |
326 { | 326 { |
327 for (auto it = list.begin(); it != list.end(); ++it) | 327 for (const auto& item : list) |
328 super::insert(*it); | 328 super::insert(item); |
329 } | 329 } |
330 | 330 |
331 ~StringMap() | 331 ~StringMap() |
332 { | 332 { |
333 } | 333 } |
334 | 334 |
335 T& operator[](const String& key) | 335 T& operator[](const String& key) |
336 { | 336 { |
337 entry_type* entry = super::find_bucket(key); | 337 entry_type* entry = super::find_bucket(key); |
338 if (entry->first.is_invalid()) | 338 if (entry->first.is_invalid()) |
339 entry = super::assign(entry, key); | 339 entry = super::assign(entry, key); |
340 return entry->second; | 340 return entry->second; |
341 } | 341 } |
342 | 342 |
343 const_reference find(const String& key) const | 343 const_reference find(const String& key) const |
344 { | 344 { |
345 return super::find(key); | 345 return super::find(key); |
346 } | 346 } |
347 | 347 |
348 reference find(const String& key) | 348 reference find(const String& key) |
349 { | 349 { |
350 return reference(this, key, super::find_bucket(key)); | 350 return reference(this, key, super::find_bucket(key)); |
351 } | 351 } |
352 }; | 352 }; |
OLD | NEW |