I'm modifying the memory of a game, therefor i do something like this:
*(float*)0x89635637 = 10.0f;
Now i want to turn this into a template function which allows me to read and set the memory with only writing the address once, i thought of something like this:
template <typename Variable> Variable GetSetAddress(Variable address, Variable value = NULL)
if (value != NULL)
*(Variable*)address = value;
Now i tried calling it like this:
float value = GetSetAddress<float>(0x89635637, 10.0f);
But it gave me this error:
error C2440: 'type cast' : cannot convert from 'float' to 'float *'
I'm pretty inexperienced with using templates, so i'd be thankful if one of you could point me in the right direction. Thanks in advance!