Every reference on google only shows easy examples, I have this case on a code:
#define XHANDLER(A,B,H) X_TO_BUS_HANDLER(A,B,H) X_FROM_BUS_HANDLER(A,B,H)
namespace{
X_TO_BUS_HANDLER( some::SomeClassX,
bus::SomeBus,
foo::SomeHandler );
Does any one know how this define works? One pattern and two token-lists? References please.
I egrepED the code but only found X_TO_BUS_HANDLER been used.
The C/C++ preprocessor will replace the pattern for everything that is written in the same line. In your case it looks as if the two token after that pattern are themselves macros, so they will get expanded as well.
Some example:
In your case I guess the two defines X_FROM_… and X_TO_… create some functions or classes that are handlers for passing an X from or to some bus, respectively. The XHANDLER macro will create handlers for both directions.