title: Range updation of values in c++ vectors
body: <p>Given a vector of integers v, whose size is n and stores all 0's initially. If I want to update some elements of a range, say from index l to r, where (0&lt;=l&lt;r&lt;n). Is there any efficient way instead of running loop from l to r?</p>
  <p>For example,
  v = {0,0,0,0,0,0,0}.
  I want to update elements from l=2 to r=5.</p>
  <p>Update refers to v[i] += k, where k is some known value. If k=1, then final updated vector in above case would be-</p>
  <p>v = {0,0,1,1,1,1,0}.</p>
  <p>Thanks:)</p>