title: Initializing a std::array with a constant value
body: <p>I need to initialize all elements of a <code>std::array</code> with a constant value, like it can be done with <code>std::vector</code>.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;array&gt;
  
  int main()
  {
    std::vector&lt;int&gt; v(10, 7);    // OK
    std::array&lt;int, 10&gt; a(7);     // does not compile, pretty frustrating
  }
  </code></pre>
  
  <p>Is there a way to do this elegantly? </p>
  
  <p>Right now I'm using this:</p>
  
  <pre><code>std::array&lt;int, 10&gt; a;
  for (auto &amp; v : a)
    v = 7;
  </code></pre>
  
  <p>but I'd like to avoid using explicit code for the initialisation.</p>