title: Aggregate initialization for array of std::pair
body: <p>As suspected, initializing <code>std::pair</code> with curly braces doesn't work because <code>std::pair</code> is not an aggregate.</p>
  
  <pre><code>std::pair &lt;int, int&gt; p = {1,2}; // Doesn't work
  </code></pre>
  
  <p>However, initializing an array of <code>std::pair</code> works well (with a warning in <code>gcc 4.9</code>)</p>
  
  <pre><code>std::pair &lt;int, int&gt; a_p[] = {
      {1,2},
      {3,4},
      {5,6}
  }; // Works fine
  </code></pre>
  
  <p>Why is this happening?</p>
  
  <p>EDIT: This question has been marked as a possible duplicate of <a href="https://stackoverflow.com/questions/27118535/c11-aggregate-initialization-for-classes-with-non-static-member-initializers">C++11 aggregate initialization for classes with non-static member initializers</a>
  However, this question does not talk about non-static-member-initializers, AFAIK, <code>std::pair</code> has a user defined constructor.
  Quoting from <a href="http://en.cppreference.com/w/cpp/header/utility" rel="nofollow noreferrer">http://en.cppreference.com/w/cpp/header/utility</a>,</p>
  
  <pre><code>template &lt;class T1, class T2&gt;
  struct pair {
      typedef T1 first_type;
      typedef T2 second_type;
  
      T1 first;
      T2 second;
      pair(const pair&amp;) = default;
      pair(pair&amp;&amp;) = default;
  
      constexpr pair();
      pair(const T1&amp; x, const T2&amp; y);
      template&lt;class U, class V&gt; pair(U&amp;&amp; x, V&amp;&amp; y);
      template&lt;class U, class V&gt; pair(const pair&lt;U, V&gt;&amp; p);
      template&lt;class U, class V&gt; pair(pair&lt;U, V&gt;&amp;&amp; p);
      template &lt;class... Args1, class... Args2&gt;
          pair(piecewise_construct_t,
               tuple&lt;Args1...&gt; first_args, tuple&lt;Args2...&gt; second_args);
  
      pair&amp; operator=(const pair&amp; p);
      template&lt;class U, class V&gt; pair&amp; operator=(const pair&lt;U, V&gt;&amp; p);
      pair&amp; operator=(pair&amp;&amp; p) noexcept(see below);
      template&lt;class U, class V&gt; pair&amp; operator=(pair&lt;U, V&gt;&amp;&amp; p);
  
      void swap(pair&amp; p) noexcept( noexcept(swap(first, p.first)) &amp;&amp;
                                   noexcept(swap(second, p.second)) );
  };
  </code></pre>