mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
AK: Rewrite HashMap::clone signature with template-args and const
This commit is contained in:
parent
dabc6dd962
commit
6421899078
2 changed files with 79 additions and 2 deletions
|
@ -281,9 +281,10 @@ public:
|
|||
return hash;
|
||||
}
|
||||
|
||||
ErrorOr<HashMap<K, V>> clone()
|
||||
template<typename NewKeyTraits = KeyTraits, typename NewValueTraits = ValueTraits, bool NewIsOrdered = IsOrdered>
|
||||
ErrorOr<HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered>> clone() const
|
||||
{
|
||||
HashMap<K, V> hash_map_clone;
|
||||
HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered> hash_map_clone;
|
||||
for (auto& it : *this)
|
||||
TRY(hash_map_clone.try_set(it.key, it.value));
|
||||
return hash_map_clone;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue