|
|
|
|
|
by umanwizard
774 days ago
|
|
No, that’s my point. It returns a reference. So it’s a good example of when you might want to return a reference, which you said seemed uncommon. But the reference it returns is unsafe (for example, it gets invalidated if the vector is later resized), whereas the reference returned by the corresponding Rust operator is safe. |
|
My overall advice here would be that if you find yourself implementing vector-like data structures very often, then it is time to take a second look the design.