title: Ambiguious constructors with single argument: initializer_list and int
body: <p>What determines which constructor should be used when initializing objects using this syntax; is it compiler dependent? (Using VS2015):</p>
  
  <pre><code>Vector v { 3 };
  </code></pre>
  
  <p>I'm creating my own <code>Vector</code> class (learning C++11) and I have the following:</p>
  
  <pre><code>class Vector
  {
  public:
      Vector(initializer_list&lt;double&gt; lst);
      Vector(int s);
      // ...
  private:
      double* elem;
      int sz;
  };
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>int main()
  {
      Vector v1 { 3 };  //calls init_list ctor
      Vector v2 { static_cast&lt;int&gt;(3)}; //calls init_list ctor
      Vector v3 = 3;    //call int ctor
  }
  </code></pre>
  
  <p>My initial thought was using the <code>{ 3 }</code> syntax would call the constructor that accepts an <code>int</code>, then realized that it makes sense since I could also use something like <code>{ 3, 4, 5, 6 }</code> and that would work--the array passed would been seen as doubles and a <code>Vector</code> would be instantiated.</p>
  
  <p>Then I thought, "how can I use the <code>{}-notation</code> and call the constructor that accepts an <code>int</code>? " I tried casting it to an <code>int</code> so that it would force use of said constructor but that didn't happen.  That's when I found out I can use the method used to init <code>v3</code>.</p>
  
  <p>I played around a little bit more and removed the constructor with the <code>initializer_list&lt;double&gt;</code> argument, and to my surprise, initializing <code>v1</code> and <code>v2</code> was calling the constructor that takes an <code>int</code> for an argument.</p>
  
  <p>So, is this normal/standard?  Is it considered a feature? I would think the <code>int</code> constructor would have precedence when passing a single <code>int</code> to the initializer vs. an implicit cast to <code>double</code> and <code>double*</code>.</p>