title: C++: How to define a data member as const
body: <p>I have the the class bellow. I want the ROI variable to  be a <code>const</code> member</p>
  
  <pre><code>class MiniPatch
  {
  private:
      cv::Mat mimOrigPatch;                                           // Original pixels
      cv::Rect roi; &lt;---- I want it to be const                                               
      int rows;
      int cols;
  
  public:
      MiniPatch(){}
      MiniPatch(cv::Point2i irPos, const cv::Mat &amp;image);
      static const int mnHalfPatchSize = 4;                           // How big is the patch?
  };
  </code></pre>
  
  <p>the implementation of the constructor is as follow:</p>
  
  <pre><code>MiniPatch::MiniPatch(cv::Point2i irPos, const cv::Mat &amp; image)
  {
    assert(pointInImageRange(image, irPos, mnHalfPatchSize));                             
    roi = cv::Rect(cv::Rect(0, 0, 2 * mnHalfPatchSize + 1, 2 * mnHalfPatchSize + 1));     
    rows = roi.height;
    cols = roi.width;
  
    cv::Rect region;
  
    region = roi + irPos - cv::Point2i(irPos.x - roi.width / 2, irPos.y - roi.height / 2); 
    mimOrigPatch = cv::Mat(region.height, region.width, CV_8UC1);                          //define the patch
      image(region).copyTo(mimOrigPatch);                                                  //crop and copy to patch image
  
  }
  </code></pre>
  
  <p>My question is: <strong>How can I define this roi variable such that it's a <code>const</code> member?</strong></p>
  
  <p>thanks</p>