Maven (famous) to Programmer [email protected] • 2 months agoI love new featureslemmy.zipmessage-square40fedilinkarrow-up1346
arrow-up1346imageI love new featureslemmy.zipMaven (famous) to Programmer [email protected] • 2 months agomessage-square40fedilink
minus-square@[email protected]linkfedilink5•2 months 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-square@[email protected]linkfedilink3•2 months agoIn C++ you should never have owning raw pointers. Unless you have a good reason™. Raw pointers are great, but not for ownership.
minus-square@[email protected]linkfedilink4•2 months 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 timeAnd you should.
It even works for classes whose constructors your implementation cannot see, if you aren’t a bitch about it.