3 ms·
> I would rather ask, why did C++ add another reference type next to pointers References were added so users could create types that look and feel like the bui
by slavik81 5y ago
> I would rather ask, why did C++ add another reference type next to pointers
References were added so users could create types that look and feel like the built-in types. You need references to implement operator[] for std::vector or std::deque.
Another example would be a vec2 class with a += operator that returns *this, just like the += operator for float.