First, some minor (and nasty) patches: The Grid class has some slightly better hacks to handle roundoff error with computing the upper bounds. The issue is that the (num cells)*(cell width)+(min offset) is not necessarily as large as the point which was used to define the maximum coordinate. I now added a 10% slop factor. I don't really like it, but without it various other things break.
The particle grid now caps the number of voxels used in the case where there are few particles scattered over a wide area. The formula used is undoubtedly not optimal. Any improvements are welcome.
BondDecorators now print their length if they have one
And the main event. I added a class internal::ObjectPointer which can be used to (guess what?) store pointers to Objects. Depending on a bool template argument it either deletes the object when the pointer is destroyed or does not. It checks various invariants like the object being OK and that only one pointer is going to delete any particular object. It is also null initialized to try to avoid problems like the model_ pointer bug from yesterday. I switched a few classes over to use it, but not an exhaustive set. I also moved Object into the internal namespace since it is just an implementation detail and you don't need to know about it do do much of anything.