title: C++ clamp function for a std::vector
body: <pre><code>void Clamp(std::vector&lt;double&gt;&amp; input_image, double min_value, double max_value, int width, int height)
  {
      for (int j = 0; j &lt; width; j++)
      {
          for (int i = 0; i &lt; height; i++)
          {
              input_image[i*width + j] = std::min(std::max(input_image[i*width + j], min_value), max_value);
          }
      }
  }
  </code></pre>
  
  <p>I am trying to create this functionality of clamping.</p>
  
  <p>Is there a better way to do it using a <code>std::vector</code>?</p>
  
  <p>I can also use C++11<Br></p>