What is the underlying structure of std::initializer_list?
问题 First part : std::initializer_list is a really helpful feature of C++11, so I wondered how it is implemented in the standard library. From what I read here, the compiler creates an array of type T and gives the pointer to the initializer_list<T> . It also states that copying an initializer_list will create a new object referencing the same data : why is it so ? I would have guessed that it either : copies the data for the new initializer_list moves ownership of the data to the new initializer