Maven (famous)@lemmy.zip to Programmer Humor@programming.dev · 13 days agoI love new featureslemmy.zipimagemessage-square40fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageI love new featureslemmy.zipMaven (famous)@lemmy.zip to Programmer Humor@programming.dev · 13 days agomessage-square40fedilink
minus-squaremarcos@lemmy.worldlinkfedilinkarrow-up0·12 days agoYeah… But it’s usually a good practice to put a struct somewhere between your 30 levels of ownership. Exceptions exist, but they are not very common. Also, in C++, operators overloading may help you if you keep needing to write code like this.
minus-squareGladaed@feddit.orglinkfedilinkarrow-up0·12 days agoIn C++ you should never have owning raw pointers. Unless you have a good reason™. Raw pointers are great, but not for ownership.
minus-squareqaz@lemmy.worldlinkfedilinkEnglisharrow-up0·12 days agoI just use unique_ptr 99% of the time
minus-squareGladaed@feddit.orglinkfedilinkarrow-up0·12 days agoAnd you should. It even works for classes whose constructors your implementation cannot see, if you aren’t a bitch about it.
Yeah… But it’s usually a good practice to put a struct somewhere between your 30 levels of ownership.
Exceptions exist, but they are not very common. Also, in C++, operators overloading may help you if you keep needing to write code like this.
In C++ you should never have owning raw pointers. Unless you have a good reason™.
Raw pointers are great, but not for ownership.
I just use unique_ptr 99% of the time
And you should.
It even works for classes whose constructors your implementation cannot see, if you aren’t a bitch about it.