I'm wondering whether sometimes (depends on the platform or compiler or context in code etc) a reference can be more efficient than a pointer?
May a reference be more efficient than a pointer?
Nopes! Not necessarily. The Standard doesn't say that either.
Most compilers implement reference mechanism via use of pointers. References were added to C++ to support operator overloading and not for efficiency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With