Show differencesHistory of post edits
#Actualnife87
Posted 01 December 2012 - 03:34 AM
Iff the hierarchy manager owns the objects in question (or is otherwise guaranteed equal or longer life time), you can pass a HierarchyManager * to every object, like you do with their parents. A simple pointer is fast to dereference and does not waste much space. If the objects are not guaranteed to die before their manager (but be sure of the reasoning of this decision), you might want to look into a std::shared_ptr<HierarchyManager> (or boost::shared_ptr if your compiler is pre-C++0X/C++11) or another form of reference-counting.
#2nife87
Posted 01 December 2012 - 03:32 AM
Iff the hierarchy manager owns the objects in question (or is otherwise guaranteed equal or longer life time), you can pass a HierarchyManager * to every object. A simple pointer is fast to dereference and does not waste much space. If the objects are not guaranteed to die before their manager, you might want to look into a std::shared_ptr<HierarchyManager> (or boost::shared_ptr if your compiler is pre-C++0X/C++11) or another form of reference-counting.
#1nife87
Posted 01 December 2012 - 03:30 AM
Iff the hierarchy manager owns the objects in question (or is otherwise guaranteed equal or longer life time), you can pass a HierarchyManager * to every objects. A pointer is simple, fast and does not waste much space. If the objects are not guaranteed to die before their manager, you might want to look into a std::shared_ptr<HierarchyManager> (or boost::shared_ptr if your compiler is pre-C++0X/C++11) or another form of reference-counting.