mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +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
|
#pragma once
|
||||||
|
|
||||||
#include "core/string/ustring.h"
|
#include "core/os/memory.h"
|
||||||
#include "core/templates/hash_map.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 StringName;
|
||||||
class Variant;
|
class Variant;
|
||||||
|
|
||||||
|
@ -182,8 +187,7 @@ private:
|
||||||
if (_metadata[meta_idx].hash == EMPTY_HASH) {
|
if (_metadata[meta_idx].hash == EMPTY_HASH) {
|
||||||
#ifdef DEV_ENABLED
|
#ifdef DEV_ENABLED
|
||||||
if (unlikely(distance > 12)) {
|
if (unlikely(distance > 12)) {
|
||||||
WARN_PRINT("Excessive collision count (" +
|
WARN_PRINT("Excessive collision count, is the right hash function being used?");
|
||||||
itos(distance) + "), is the right hash function being used?");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
_metadata[meta_idx] = metadata;
|
_metadata[meta_idx] = metadata;
|
||||||
|
@ -657,16 +661,20 @@ public:
|
||||||
|
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
|
|
||||||
AHashMap(const AHashMap &p_other) {
|
AHashMap(AHashMap &&p_other) {
|
||||||
_init_from(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) {
|
AHashMap(const AHashMap &p_other) {
|
||||||
reserve(p_other.size());
|
_init_from(p_other);
|
||||||
for (const KeyValue<TKey, TValue> &E : p_other) {
|
|
||||||
uint32_t hash = _hash(E.key);
|
|
||||||
_insert_element(E.key, E.value, hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator=(const AHashMap &p_other) {
|
void operator=(const AHashMap &p_other) {
|
||||||
|
@ -679,15 +687,6 @@ public:
|
||||||
_init_from(p_other);
|
_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) {
|
AHashMap(uint32_t p_initial_capacity) {
|
||||||
// Capacity can't be 0 and must be 2^n - 1.
|
// Capacity can't be 0 and must be 2^n - 1.
|
||||||
_capacity_mask = MAX(4u, p_initial_capacity);
|
_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 {
|
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) {
|
for (const KeyValue<Animation::TypeHash, AnimationMixer::TrackCache *> &E : data) {
|
||||||
AnimationMixer::TrackCache *track = get_cache_copy(E.value);
|
AnimationMixer::TrackCache *track = get_cache_copy(E.value);
|
||||||
ERR_CONTINUE(!track); // Backup shouldn't contain tracks that cannot be copied, this is a mistake.
|
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