02-08-2012, 11:44 PM
We could always handle chunk pointers as std::tr1::shared_ptr<cChunk>.
Though a colleague of mine says "shared pointers and reference counting is the poor man's solution to poor man's design - you should instead design so that you always know who owns the object and who's responsible for destroying it." and over time I've come to agree with him. There are only a very few situations where reference-counting is really necessary, and by redesigning our code not to use it, we were able to eliminate 99 % of weird bugs reported with our app.
Though a colleague of mine says "shared pointers and reference counting is the poor man's solution to poor man's design - you should instead design so that you always know who owns the object and who's responsible for destroying it." and over time I've come to agree with him. There are only a very few situations where reference-counting is really necessary, and by redesigning our code not to use it, we were able to eliminate 99 % of weird bugs reported with our app.