mirror of
https://github.com/godotengine/godot.git
synced 2026-02-07 19:32:36 +00:00
Add std::initializer_list constructor for Dictionary.
This commit is contained in:
@@ -693,6 +693,15 @@ Dictionary::Dictionary() {
|
||||
_p->refcount.init();
|
||||
}
|
||||
|
||||
Dictionary::Dictionary(std::initializer_list<KeyValue<Variant, Variant>> p_init) {
|
||||
_p = memnew(DictionaryPrivate);
|
||||
_p->refcount.init();
|
||||
|
||||
for (const KeyValue<Variant, Variant> &E : p_init) {
|
||||
operator[](E.key) = E.value;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary::~Dictionary() {
|
||||
_unref();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user