title: overload [ ] [ ] operator for image manipulating
body: <p>i've got a Class Image with a member called buffer, a vector of unsigned char that store the pixels of image. I'd like to handle this buffer as a matrix.i'd like to access to the buffer as <strong>img[ i ][ j ]</strong> but i've not idea how? anyone can suggest me a solution?</p>
  
  <p>here's my tentative:</p>
  
  <pre><code>unsigned char * &amp;Image::operator[](int i) {
  
         return buffer[ rows+i  ]
  }
  </code></pre>
  
  <p>i read this <a href="https://stackoverflow.com/questions/6969881/operator-overload">post</a> then i think that is possible. my class is like that:</p>
  
  <pre><code>class Image {
  
  
  private:
  
  unsigned char * buffer;
  int buf_size;
  int rows;
  int cols;
  Phisical_img_manager phisical_img_manager;
  
  const char * in_img_filename;
  
  
  public:
  
  unsigned char * &amp; operator[](int i);
  
  Image(const char * in_img_filename);
  
  unsigned char * get_buffer();
  int get_cols();
  int get_rows();
  
  };
  </code></pre>