I tried the following code for debugging in a C++17 template:
Basically I want to write a general debugging statement which would yield, say, int a=2; then deb(a) should output-> {a: 2} and for multivariables, it should be output: {a: 2,b: 3,...}
template<typename... Args>void deb(Args... args){
(((cout<<#args)<<" "<<args),...);
cout<<"\n";
}
And in my main function, I executed the following commands:
int a=2, b=3, c=4;
deb(a, b, c);
It shows a compilation error, stray #
in program.
Where am I wrong?