Function change() can change local variable tmp or can fail to change it.
1 2 3 4 5 6 7 8 9
void change_tmp(void *buffer);
template<class T>
T getInfo()
{
T tmp; // <----- I want here a default initialization. 0 for numbers, "" for strings.
change_tmp(&tmp); // Can fail to change tmp.
return tmp;
}
How can I do this default initialization on primitives?
For instance if T=int I have int tmp;
but I want int tmp=0;