Not quite. You’d need to know how a given function is defined to argue that.
EEPROM.get() it’s simply not correct.
By reference (in the legacy interpretation) shall not be confused with C++ references.
C++ references need to be declared as
T& thisReference but passing a parameter to a function via
foo(&someParameter) is not passing a C++ reference.
For a function to take a C++ reference it needs to be declared that way
void foo(T& someParameter);
and called as
In the process of passing
var (mark the lack of a leading ampersand
&) a C++ reference
someParameter is created and henceforth will act as if you were directly dealing with
var itself (
someParameter has become a synonym for
var - however, the latter is outside the function’s scope and hence couldn’t be used by
That’s even illustrated in the
swap() sample in the link you provided
(no ampersands for
On the other hand, once your function receives a
void* to some entity that parameter will only be a pointer and any C++ reference off that pointer will, in turn, only be a pointer but never again the original entity.
There are ways to do that, but you will not get around the need to actually having a variable off which you can pull a proper C++ reference.
Templating would be one way.
Creating a temporary correctly typed variable by dereferencing the pointer and type casting would be another.