I am writing a macro which get std stream as arguments. For example
file.h
int enable = 0;
#define MYLOG(hanlde) \
if (enable==0) { LOG1(handle) } \
else { LOG2(handle) }
file.cpp
MYLOG(handle) << "Test log msg";
My intended result after preprocessor execution must be
LOG1(handle) << "Test log msg"; // if handle = 0
LOG2(handle) << "Test log msg"; // if handle = 1
Does this possible with macro in c++. If possible please provide the example.