#和## —— 摘自C++ API

#,##

# 和 ## 操作符是和#define宏使用的. 使用# 使在#后的首个参数返回为一个带引号的字符串. 例如, 命令

    #define to_string( s ) # s

将会使编译器把以下命令

    cout << to_string( Hello World! ) << endl;

理解为

    cout << "Hello World!" << endl;

使用##连结##前后的内容. 例如, 命令

    #define concatenate( x, y ) x ## y
    ...
    int xy = 10;
    ...

将会使编译器把

    cout << concatenate( x, y ) << endl;

解释为

    cout << xy << endl;

理所当然,将会在标准输出处显示'10'. 

你可能感兴趣的:(C++)