What is the type of myCollection after the following declaration?
auto myCollection = {1, 2, 3};Show answer and explanation
The declaration deduces std::initializer_list<int> because copy-list initialization with auto uses the initializer-list deduction rule. The elements must agree on one deduced element type.
The declaration deduces std::initializer_list<int> because copy-list initialization with auto uses the initializer-list deduction rule. The elements must agree on one deduced element type.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.