I have these two functions:
void CheckOneConditionInt( int &SettingsEditValueInt );
void CheckOneConditionDbl( double &SettingsEditValueDbl );
They do the same stuff, but one is used with int
values and another is used with double
values. Is there any way to make it one function that can take int/double as an argument? For example:
void CheckOneCondition( void &SettingsEditValue );
PS: The example does not work of course.
The problem is solved by using templates:
template<typename T>
void CheckOneCondition( T &SettingsEditValue );
I can then call it passing double
or int
parameter.