My experience with auto pointers suggests this might be useful.