Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Fast element access macro in C++ API

Is there any reason I should not use a macro for fast element access in C++ API (like CV_MAT_ELEM_PTR_FAST in C API)?

Fast element access macro in C++ API

Is there any reason I should not use a macro for fast element access in C++ API (like CV_MAT_ELEM_PTR_FAST in C API)?API)? Here's my implementation

 #define MY_CV_MAT_ELEM_PTR_FAST( mat, row, col, elemtype )  \
(assert( (unsigned)(row) < (unsigned)(mat).rows &&   \
         (unsigned)(col) < (unsigned)(mat).cols ),   \
   (* (elemtype*) ( (mat).data + (mat).step*(row) + (sizeof(elemtype)*(col)) ) ) )

Fast element access macro in C++ API

Is there any reason I should not use a macro for fast element access in C++ API (like CV_MAT_ELEM_PTR_FAST in C API)? Here's my implementation

 #define MY_CV_MAT_ELEM_PTR_FAST( MY_MAT_ELEM_PTR_FAST( mat, row, col, elemtype )  \
(assert( (unsigned)(row) < (unsigned)(mat).rows &&   \
         (unsigned)(col) < (unsigned)(mat).cols ),   \
   (* (elemtype*) ( (mat).data + (mat).step*(row) + (sizeof(elemtype)*(col)) ) ) )