Replies: 1 comment
-
there shouldn't be any difference in performance between pass-by-value and pass-by-reference here the "borrow-checker" should be able to determine if the value is borrowed later, if it isn't it won't allocate memory aptos also has vector::trim so you can free all the memory in a single operation here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe your question in detail.
Let's say I have a vector like this:
I want a function like this:
I would call it like this:
Afterwards,
v
would look like this:filter
mostly works how I want but it allocates a new vector, it doesn't operate in place.I have this at the moment:
Is there a better, more obvious way that I'm missing?
Overall I think the vector functions need to be more clearly separated by those that create copies vs those that work in place.
What error, if any, are you getting?
No response
What have you tried or looked at? Or how can we reproduce the error?
No response
Which operating system are you using?
macOS
Which SDK or tool are you using? (if any)
N/A
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions