title: Initialize C-style array with non-zero value without loops
body: <p>We know that C++ allows <a href="http://www.cplusplus.com/doc/tutorial/arrays/" rel="nofollow noreferrer">initialization of C-style arrays with zeros</a>:</p>
  <pre><code>int a[5] = {0};
  // or
  int a[5] = {};
  </code></pre>
  <p>The same works for std::array</p>
  <pre><code>std::array a&lt;int, 5&gt; = {};
  </code></pre>
  <p>However, this won't work:</p>
  <pre><code>int a[5] = {33}; // in memory( 33, 0, 0, 0, 0 )
  std::array&lt;int, 5&gt; = {33}; // in memory( 33, 0, 0, 0, 0 )
  </code></pre>
  <p>Is there any way to initialize the whole array with a non-zero value without using <code>vector</code> or <code>algorhtm</code>?</p>
  <p>Maybe <code>constexpr</code> could help? What would be the best solution?</p>
  <p>P.S.:</p>
  <p>GCC offers <a href="http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html" rel="nofollow noreferrer">this syntax</a></p>
  <pre><code>int a[5] = {[0 ... 4] = 33};
  </code></pre>
  <p>but I am not sure if it is valid for other compilers.</p>