I have the following macro definition:
#if DEBUG
#include <iostream>
#include <ostream>
#define LOG(x) std::cout << x << std::endl;
#else
#define LOG(x) // LOG(x) is replaced with nothing in non-debug
#endif
How would an equivalent function look like that allows this?:
LOG("This is a Test message" << " with " << testVariable << " a variable");
my current implementation looks like this:
template <typename T>
inline void logD(const T& x) {
if constexpr (Debug) {
std::cout << x << std::endl;
}
};
but I get the following error:
error C2296: '<<': illegal, left operand has type 'const char [25]'
replacing <<
with +
for concatenating doesnt help either
error C2110: '+': cannot add two pointers