title: Why do we use initializer_list in C++11?
body: <p>I read <code>initializer_list</code> is for functions taking an unknown number of arguments of a single type. But why do we need it? Why can't we use normal containers instead, like <code>vector</code> or <code>list</code>?</p>
  
  <p>I tried the following code, and it works.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;list&gt;
  #include &lt;string&gt;
  using namespace std;
  
  void f(const list&lt;string&gt; &amp;slst)
  {
      for (auto s : slst)
          cout &lt;&lt; s &lt;&lt; endl;
  }
  
  int main()
  {
      f({ "Good", "morning", "!" });
      system("pause");
      return 0;
  }
  </code></pre>