how to initialize std::array with std::initializer_list in C++0x?
I am studying C++0x with gcc 4.4.0 these days.
Here I need to initialize a std::array object within a function which has a parameter of type std::initializer_list, as below:
What should I do in the place with '****' to make my_array initialized?
template<typename T, int S>
void Foo(std::initializer_list<T> init_list)
std::array<T, S> my_array = ****
T is a type which needs explicit construction, which means I can not construct my_array as default, then copy every element from init_list to it.
The type & size of init_list can be known during compiling time, so I believe there should be some way to make use of them.
Can anyone give me some advice?
Thanks in advance.