Hey.
Just a thing I am using to manage reference-counted Irrlicht objects.
It's a small smartpointer class which caries about deletion, copy + move semantics and therefore adds exception safety and safes you from remembering to call grab + drop directly.
It seems you are missing tests if you assign the pointer to itself as well as if you assign that irr_ptr to itself. For example you drop the old pointer before you grab a new one - if it's the same pointer and this is the last reference you just killed your pointer.
I didn't wrap it.. I made a game engine, or making. I simply ripped off reference counter and added it to my engine which I plan to rewrite. Now you've provided some code I can use to expand, appreciated!
I'm guessing how many irr_ptr will be posted in future
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
I can understand if there are no similiar snippets in the same page anyway nice snippet. Is always nice to see 100+1 different ways for doing almost the same thing.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
I had a look at the code. I'm thinking this isn't going to work for things you get from the engine that you aren't supposed to drop (despite the fact that they inherit IReferenceCounted) - For example, images and things loaded from file - unless the first pointer used to store them is not of this pointer type.
Otherwise nice work.
EDIT: It'd be nice if there was a "quiet drop" - some way of setting the pointer to null without deleting the data.
I'm considering a new type of "smart pointer". maybe i'll post the snippet. nor boost or other frameworks have this so probably is useless xD
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me