With std::initializer_list.
You can also consider a variadic template constructor, but this is less ideal because of the overload resolution mechanism's preference for that constructor over many other near matches.
thanks;but
In debugging this program below error appears:
'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' Project2 c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.11.25503\include\xutility
can you resolve it?
I work with visual studio 2017.
Alternatively, you may change the design. No matter what the compiler says about std::copy, std::initializer_list is still the subject of the answer - the rest of the code is only an example.