有段define代码没看懂

有段define代码没有看懂#define AOP(OP)\void operator OP(T scalar)\{\const int cx Width()\const in

有段define代码没有看懂

  #define AOP(OP)                                 \
        void operator OP(T scalar)                      \
        {                                               \
            const int cx = Width();                     \
            const int cy = Height();                    \
            for (int y = 0; y < cy; y ++)               \
            {                                           \
                T* p = RowPtr(y);                       \
                for (int x = 0 ; x < cx; x ++)          \
                {                                       \
                    (*p++) OP scalar;                   \
                }                                       \
            }                                           \
        }                                               \

        /// Usage: Image *= scale;


        AOP(+=) AOP(-=) AOP(*=) AOP(/=)
        AOP(&=) AOP(|=) AOP(^=)
        AOP(>>=) AOP(<<=)
        #undef AOP


[解决办法]
运算符重载
Image *= scale;
比如
Image数据是一个二维数组组成的
 T* p = RowPtr(y); 得到每行指针.
(*p++) OP scalar;   对行中每个元素都执行 OP 操作
比如
OP:  *=
Image date:
{{3, 2}, {1, 8}}
scale:  3
那么
结果就是 date:
{{9, 6}, {3, 24}}

其他操作类似. 
    
[解决办法]
上面说的都对,只要知道\是续行符,还有运算符重载,就能看懂了。
[解决办法]
楼主知道:带参数的宏这一概念吗?这就是。楼主可以找本书来看看就明白了。
[解决办法]
引用:
inline void operator OP##= (ShortXY&amp; lhs, short scale)          \
    {                                                               \
        lhs.X = lhs.X OP scale;           ……

##可以用于连接两个参数。类似地,#可以使参数字符串化,#@可以使参数字符化。

#include<iostream>
using namespace std;
#define merge(x,y) x##y
int main()
{
cout<<merge(5,2)<<endl;
cout<<merge("minmin, ","i love you!")<<endl;

return 0;
}