Skip to content
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] Why to use copy constructor if can write straight to the object #416

Open
amgross opened this issue Mar 17, 2024 · 0 comments
Open

Comments

@amgross
Copy link
Contributor

amgross commented Mar 17, 2024

virtual MessageBuffer create(void) = 0;

How this API is currently, the user of it must have its own object, and the implementation of this API must create the object on its stack/global/whatever and then while returning copy constructor is called.

Why not to make it so the user jut give its object?
virtual MessageBuffer *create(MessageBuffer *buf) = 0;

@amgross amgross changed the title Why to use copy constructor if can write straight to the object [QUESTION] Why to use copy constructor if can write straight to the object Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant