One of the biggest reasons why I tend to avoid using variadic arguments/parameter packs as function parameters is they don't do type checking. Something key to C++.
lastchance shows an example that preserves type checking, using a C++ feature that is usually ignored. I know std::valarray<> wouldn't be something I'd use without some thinking.
|This one does not work for me with the latest VS version
That example requires C++17 (or later), VS defaults to compiling using C++14.
You should consider modifying your defaults globally to use /std:c++20 (/std:c++latest actually if you want to use C++20 features) so each new project/solution will automatically use /std:c++20 or /std::c++latest.
See helios' reply for how to make global modifications to the default project properties:
And then my follow-up reply how to find the Property Manager window.
Now, instead of adding library directories globally you want to modify the C++ Language Standard used in Common Properties -> C/C++ -> Language.
Change the language standard for Win32 and x64, it doesn't matter if Debug or Release. I choose Release.
Close the Property Manager window, you may get a dialogue to save changed properties. YES! Save them.
Now, if this change happened every new project you create should use the later language standard you selected.
I really recommend /std:c++latest. That is what I chose for my defaults.
[Edited to Add]: And, yes, this works for VS 2022 as well as VS 2017/2019. Every new Boost release I modify my default library paths to the new Boost version. Takes just a couple of minutes.
Downloading and building Boost takes some time. I have that build procedure down to a couple of console commands. Build for both Win32 and x64, Debug and Release.