| 279 | // If asserts are enabled then we need to return a proxy class so we can make sure |
| 280 | // the column accesses don't go out of bounds. |
| 281 | struct pix_row |
| 282 | { |
| 283 | pix_row(pixel_type* data_, long nc_) : data(data_),_nc(nc_) {} |
| 284 | const pixel_type& operator[] (long col) const |
| 285 | { |
| 286 | DLIB_ASSERT(0 <= col && col < _nc, |
| 287 | "\t The given column index is out of range." |
| 288 | << "\n\t col: " << col |
| 289 | << "\n\t _nc: " << _nc); |
| 290 | return data[col]; |
| 291 | } |
| 292 | pixel_type& operator[] (long col) |
| 293 | { |
| 294 | DLIB_ASSERT(0 <= col && col < _nc, |
| 295 | "\t The given column index is out of range." |
| 296 | << "\n\t col: " << col |
| 297 | << "\n\t _nc: " << _nc); |
| 298 | return data[col]; |
| 299 | } |
| 300 | private: |
| 301 | pixel_type* const data; |
| 302 | const long _nc; |
| 303 | }; |
| 304 | pix_row operator[] (long row) |
| 305 | { |
| 306 | DLIB_ASSERT(0 <= row && row < _nr, |
no outgoing calls
no test coverage detected