title: Replace a range of elements in a vector with a value
body: <p>I want to replace any value from a position <code>a</code> to a position <code>b</code> inside my vector.</p>
  
  <p>I read about <a href="http://www.cplusplus.com/reference/algorithm/replace/" rel="nofollow noreferrer">replace function</a>, but I have to specify the value that I want replaced. I need to replace any values.</p>
  
  <p>For example if the vector is: <code>1 2 3 4 5 6 7 8 9 0 0 0 0 0 0</code>, and I want to replace all the elements from position 0 to position 8 with another value, how can I use that <code>replace</code> function?</p>
  
  <p>Now I'm using a for loop to do that, but my program is very slow.</p>