Initialized reference in function
Hey, if I want to have a function that can take a reference value as argument but also have that value initialized if no such value is supplied when calling the function, how would that be done?
I would like something like this (which is not working)
So that I can call this function in both these ways:
int Function(float &value = 0.0f);
int Function(float &value)
value = 5.0f;}
int vertex = Function();
I would rather like to avoid function overloading. Is there a way to write the definition of the function to make it work?
int vertex = Function(value);