-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question about copy elision #3414
Comments
This is #2765. |
Awesome, thank you very much :) Related question: Do you advise against designing an API around this feature? Would it be more reliable to have my function still take a pointer to |
Bump – You upvoted my comment just before I made the edit, which makes me think you're never going to see it otherwise. I'm sorry if that's not the case ^^ |
If the semantics of your application depend on elision, you can't write the code this way, you'll have to take a pointer. But I fully intend on making #2765 a reality, which means that when the issue is implemented, you could then improve your API to not need to take a pointer anymore. There are a bunch of places in the std lib that are affected in this way. |
Oh... didn't notice the issue is still open. I'll wait it out then. Thanks for your (and every other contributors) work by the way. I never really used Zig for something productive, but it got me into low-level programming and is amazingly fun to work with :) |
Hey guys,
I have a question about the newly introduced copy elision. Is the compiler able to determine that it should immediately write into
first_set.data
in the unionize function?Edit: I'm sorry if this seems like a code-dump, but I wanted to provide a running example :)
The text was updated successfully, but these errors were encountered: