title: Passing std::vector for any type to a function
body: <p>Given:</p>
  
  <pre><code>template&lt;typename T&gt; class A {  
    B b;
    std::vector&lt;T&gt; vec1;
    std::vector&lt;T&gt; vec2;
  }
  </code></pre>
  
  <p>I'd like B to have a member function that fill() that takes a reference to those to vectors and fills vec2 with values of T depending on some information contained in b.<br>
  One way of doing this is overloading fill() for each possible argument T:  </p>
  
  <pre><code>fill(const std::vector&lt;float&gt;&amp; a, std::vector&lt;float&gt;&amp; b)
  </code></pre>
  
  <p>and so on but this will mean a lot of unnecessary duplication as the operations are the same for every possible T. Inside of fill() I could use vector::value_type for the calculations but I don't know how to declare it in such a way that it takes every kind of std::vector. The obvious way would be to use a free function with templates. Is there a simpler way of doing this?</p>