mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Remove hash_map.h
include from a_hash_map.h
, and remove cross conversion operators.
This commit is contained in:
parent
d413181b8a
commit
d6036462b1
2 changed files with 21 additions and 22 deletions
|
@ -30,9 +30,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "core/templates/hashfuncs.h"
|
||||
#include "core/templates/pair.h"
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
class String;
|
||||
class StringName;
|
||||
class Variant;
|
||||
|
||||
|
@ -182,8 +187,7 @@ private:
|
|||
if (_metadata[meta_idx].hash == EMPTY_HASH) {
|
||||
#ifdef DEV_ENABLED
|
||||
if (unlikely(distance > 12)) {
|
||||
WARN_PRINT("Excessive collision count (" +
|
||||
itos(distance) + "), is the right hash function being used?");
|
||||
WARN_PRINT("Excessive collision count, is the right hash function being used?");
|
||||
}
|
||||
#endif
|
||||
_metadata[meta_idx] = metadata;
|
||||
|
@ -657,16 +661,20 @@ public:
|
|||
|
||||
/* Constructors */
|
||||
|
||||
AHashMap(const AHashMap &p_other) {
|
||||
_init_from(p_other);
|
||||
AHashMap(AHashMap &&p_other) {
|
||||
_elements = p_other._elements;
|
||||
_metadata = p_other._metadata;
|
||||
_capacity_mask = p_other._capacity_mask;
|
||||
_size = p_other._size;
|
||||
|
||||
p_other._elements = nullptr;
|
||||
p_other._metadata = nullptr;
|
||||
p_other._capacity_mask = 0;
|
||||
p_other._size = 0;
|
||||
}
|
||||
|
||||
AHashMap(const HashMap<TKey, TValue> &p_other) {
|
||||
reserve(p_other.size());
|
||||
for (const KeyValue<TKey, TValue> &E : p_other) {
|
||||
uint32_t hash = _hash(E.key);
|
||||
_insert_element(E.key, E.value, hash);
|
||||
}
|
||||
AHashMap(const AHashMap &p_other) {
|
||||
_init_from(p_other);
|
||||
}
|
||||
|
||||
void operator=(const AHashMap &p_other) {
|
||||
|
@ -679,15 +687,6 @@ public:
|
|||
_init_from(p_other);
|
||||
}
|
||||
|
||||
void operator=(const HashMap<TKey, TValue> &p_other) {
|
||||
reset();
|
||||
reserve(p_other.size());
|
||||
for (const KeyValue<TKey, TValue> &E : p_other) {
|
||||
uint32_t hash = _hash(E.key);
|
||||
_insert_element(E.key, E.value, hash);
|
||||
}
|
||||
}
|
||||
|
||||
AHashMap(uint32_t p_initial_capacity) {
|
||||
// Capacity can't be 0 and must be 2^n - 1.
|
||||
_capacity_mask = MAX(4u, p_initial_capacity);
|
||||
|
|
|
@ -2508,7 +2508,7 @@ void AnimatedValuesBackup::set_data(const AHashMap<Animation::TypeHash, Animatio
|
|||
}
|
||||
|
||||
AHashMap<Animation::TypeHash, AnimationMixer::TrackCache *, HashHasher> AnimatedValuesBackup::get_data() const {
|
||||
HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> ret;
|
||||
AHashMap<Animation::TypeHash, AnimationMixer::TrackCache *, HashHasher> ret;
|
||||
for (const KeyValue<Animation::TypeHash, AnimationMixer::TrackCache *> &E : data) {
|
||||
AnimationMixer::TrackCache *track = get_cache_copy(E.value);
|
||||
ERR_CONTINUE(!track); // Backup shouldn't contain tracks that cannot be copied, this is a mistake.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue