jeudi 24 août 2017

support << operator in a macro

I'd like to implement a macro which does the following:

#define report(s)   print(), throw std::runtime_error(s)

print() is a function that I always call to print some predefined stuff. s need to support:

report("abc"); // ok
report("abc"<<100); // how to implement this?

Apart from whatever print() outputs, Nothing else should be printed. The exception will be caught by the caller and printed there.

I find it difficult to support << in the above macro.

Aucun commentaire:

Enregistrer un commentaire