title: Multiplying each element of an std::array at compile time
body: <p>I would like to convert an <code>std::array</code> to another <code>std::array</code>, multiplying each of its elements by a specific number.</p>
  
  <p>What I have right now obviously doesn't work:</p>
  
  <pre><code>#include &lt;array&gt;
  #include &lt;iostream&gt;
  #include &lt;utility&gt;
  
  template &lt;class T, size_t... Is, size_t N&gt;
  constexpr std::array&lt;T, N&gt; multiply(std::array&lt;T, N&gt; const &amp;src,
                                    std::index_sequence&lt;Is...&gt;) {
      return std::array&lt;T, N&gt;{{src[Is]...}}; // How can I multiply each of src's elements?
  }
  
  int main(int argc, char *argv[]) {
      constexpr std::array&lt;int, 3&gt; arr = {1, 2, 3};
      constexpr auto t = multiply(arr, std::make_index_sequence&lt;3&gt;{});
      for (auto &amp;el : t) std::cout &lt;&lt; el &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>My question is: how can I iterate over each element at compile time or how can I apply the same function (in my case: multiply by 2) at compile time?</p>