From 8f36c97a49dc340b81f6cbc1d97171da212a77e0 Mon Sep 17 00:00:00 2001 From: Yufeng Ying Date: Sun, 29 Jun 2025 23:56:17 +0800 Subject: [PATCH] Optimize varray. --- core/variant/variant.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/core/variant/variant.h b/core/variant/variant.h index cf77a3d8a3..fd732c7960 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -873,25 +873,9 @@ public: } }; -//typedef Dictionary Dictionary; no -//typedef Array Array; - template Vector varray(VarArgs... p_args) { - Vector v; - - Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. - uint32_t argc = sizeof...(p_args); - - if (argc > 0) { - v.resize(argc); - Variant *vw = v.ptrw(); - - for (uint32_t i = 0; i < argc; i++) { - vw[i] = args[i]; - } - } - return v; + return Vector{ p_args... }; } struct VariantHasher {