title: Sum of two containers in generic function
body: <p>I need to write a generic function that finds sum of elements that belong to two containers and put those elements inside a vector which type is the result of sum.</p>
  <blockquote>
  <p>EXAMPLE:</p>
  <p>container one: 5 2 8 3 6</p>
  <p>container two: 6 1 5</p>
  <p>container of sum: 11 3 13 3 6</p>
  </blockquote>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;vector&gt;
  
  template &lt; typename tip1, typename tip2, typename tip &gt;
    tip sum_of_containers(tip1 blok1, tip2 blok2) {
      std::vector &lt; tip &gt; a;
      int n1 = std::distance(blok1.begin(), blok1.end());
      int n2 = std::distance(blok2.begin(), blok2.end());
      int n;
      n = n1;
      if (n2 &gt; n1) n = n2;
      for (int i = 0; i &lt; n; i++)
        a[i].push_back(blok1[i] + blok2[i]);
      return a;
    }
  
  int main() {
    int n1, n2, x;
    std::cin &gt;&gt; n1;
    std::vector &lt; double &gt; a, b, c;
    for (int i = 0; i &lt; n1; i++) {
      std::cin &gt;&gt; x;
      a.push_back(x);
    }
    std::cin &gt;&gt; n2;
    for (int i = 0; i &lt; n2; i++) {
      std::cin &gt;&gt; x;
      b.push_back(x);
    }
    c = sum_of_containers(a, b);
    for (double i: c)
      std::cout &lt;&lt; i &lt;&lt; &quot; &quot;;
    return 0;
  }
  </code></pre>
  <p>errors on line 31:</p>
  <blockquote>
  <p>no matching function for call to 'sum_of_containers</p>
  <p>couldn't deduce template parameter 'tip'</p>
  </blockquote>
  <p>Could you give me some approach or idea how to solve this problem?</p>