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

T& TPZAutoPointer<T>::operator #111

Open
orlandini opened this issue Jul 21, 2021 · 1 comment
Open

T& TPZAutoPointer<T>::operator #111

orlandini opened this issue Jul 21, 2021 · 1 comment

Comments

@orlandini
Copy link
Member

While I fail to see a way in which this user-defined conversion can lead to a serious issue (i.e., the pointer being deleted during a function call), I think this operator allows for the compiler to perform conversions we might not be aware of.

The only drawback (that I can see) of removing this operator is to precede the name of the TPZAutoPointer<T> instance with *, as with raw pointers. And I think the code would actually be clearer.

#55 would of course solve this issue, but I don't see it happening so soon...

@philippedevloo
Copy link
Member

When passing an object as reference, the called method is not "supposed" to call the destructor on the address of the object it received. By the same token, as the user can ask for the address of the first element of a full matrix, he "could" delete it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants