I tried following code for debugging in 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 following commands:
int a=2,b=3,c=4;
deb(a,b,c);
It shows compilation error that stray # in program
Please do guide me where I am wrong. Thanks in advance.