From b105de0137fe94b7494a8854a47b87c56a2fe937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=92=E6=95=85=E9=87=8C?= <3326284481@qq.com> Date: Sat, 16 Mar 2024 13:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=A6=81=E6=AD=A2=E4=BA=86=E4=BB=8E=E6=95=B4?= =?UTF-8?q?=E6=95=B0=E7=B1=BB=E5=9E=8B=E5=88=B0=E6=B5=AE=E7=82=B9=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E8=BD=AC=E6=8D=A2=EF=BC=8C=E8=99=BD=E7=84=B6?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=B8=8D=E4=BC=9A=E6=9C=89=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=E6=8D=9F=E5=A4=B1=20https://zh.cppreference.com/w/cpp/language?= =?UTF-8?q?/list=5Finitialization=E3=80=82=20=E4=BF=AE=E6=AD=A3=EF=BC=88?= =?UTF-8?q?=E8=99=BD=E7=84=B6gcc=20=E5=92=8C=20msvc=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=BC=96=E8=AF=91=EF=BC=89=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E5=BC=8F=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=EF=BC=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=9Ahttps://godbolt.org/z/az9o3o9qe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../01\345\207\275\346\225\260\346\250\241\346\235\277.md" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/md/\347\254\254\344\270\200\351\203\250\345\210\206-\345\237\272\347\241\200\347\237\245\350\257\206/01\345\207\275\346\225\260\346\250\241\346\235\277.md" "b/md/\347\254\254\344\270\200\351\203\250\345\210\206-\345\237\272\347\241\200\347\237\245\350\257\206/01\345\207\275\346\225\260\346\250\241\346\235\277.md" index ea39eab..bf671f8 100644 --- "a/md/\347\254\254\344\270\200\351\203\250\345\210\206-\345\237\272\347\241\200\347\237\245\350\257\206/01\345\207\275\346\225\260\346\250\241\346\235\277.md" +++ "b/md/\347\254\254\344\270\200\351\203\250\345\210\206-\345\237\272\347\241\200\347\237\245\350\257\206/01\345\207\275\346\225\260\346\250\241\346\235\277.md" @@ -585,7 +585,7 @@ int main() { template> RT sum(const Args&...args) { - RT _[]{ args... }; + RT _[]{ static_cast(args)... }; RT n{}; for (int i = 0; i < sizeof...(args); ++i) { n += _[i]; @@ -594,7 +594,7 @@ RT sum(const Args&...args) { } int main() { - double ret = sum(1, 2, 3, 4, 5,6.7); + double ret = sum(1, 2, 3, 4, 5, 6.7); std::cout << ret << '\n'; // 21.7 } ```