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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 typedef typename super::size_type size_type; | 308 typedef typename super::size_type size_type; |
309 typedef typename super::entry_type entry_type; | 309 typedef typename super::entry_type entry_type; |
310 typedef typename super::key_type_cref key_type_cref; | 310 typedef typename super::key_type_cref key_type_cref; |
311 typedef typename entry_type::value_type value_type; | 311 typedef typename entry_type::value_type value_type; |
312 typedef typename super::const_reference const_reference; | 312 typedef typename super::const_reference const_reference; |
313 typedef Map_internal::MapReference<entry_type> reference; | 313 typedef Map_internal::MapReference<entry_type> reference; |
314 friend struct Map_internal::MapReference<entry_type>; | 314 friend struct Map_internal::MapReference<entry_type>; |
315 | 315 |
316 using super::super; | 316 using super::super; |
317 | 317 |
| 318 Map() |
| 319 { |
| 320 } |
| 321 |
318 Map(std::initializer_list<entry_type> list) | 322 Map(std::initializer_list<entry_type> list) |
319 : super(list.size()) | 323 : super(list.size()) |
320 { | 324 { |
321 for (const auto& item : list) | 325 for (const auto& item : list) |
322 super::insert(item); | 326 super::insert(item); |
323 } | 327 } |
324 | 328 |
325 value_type& operator[](key_type_cref key) | 329 value_type& operator[](key_type_cref key) |
326 { | 330 { |
327 entry_type* entry = super::find_bucket(key); | 331 entry_type* entry = super::find_bucket(key); |
328 if (entry->is_invalid()) | 332 if (entry->is_invalid()) |
329 entry = super::assign(entry, key); | 333 entry = super::assign(entry, key); |
330 return entry->second; | 334 return entry->second; |
331 } | 335 } |
332 | 336 |
333 const_reference find(key_type_cref key) const | 337 const_reference find(key_type_cref key) const |
334 { | 338 { |
335 return super::find(key); | 339 return super::find(key); |
336 } | 340 } |
337 | 341 |
338 reference find(key_type_cref key) | 342 reference find(key_type_cref key) |
339 { | 343 { |
340 return reference(this, key, super::find_bucket(key)); | 344 return reference(this, key, super::find_bucket(key)); |
341 } | 345 } |
342 }; | 346 }; |
343 | 347 |
344 ABP_NS_END | 348 ABP_NS_END |
OLD | NEW |