On 28-2-2014 20:25, Jon Cruz wrote:
On Jan 21, 2014, at 10:04 AM, Johan Engelen wrote:
How large do we expect this list to be? I advise list<T> for now (moving onto unique_ptr when we make the switch to C++11), just for the sake of simplicity and not unnecessarily relying on external deps. I think there is a much higher chance of a dev knowing the semantics of list<unique_ptr<T>> than boost::ptr_list<T>.
Please also document that the pointers in the list are owning pointers (i.e. the SPDoc owns its children and deletes them when it itself is deleted).
Hi guys. Sorry that I hit this a bit late.
However, there is one very important thing here. For a container, std::list<> and the ilk should be the last choice, and only after management and performance have been carefully worked out. Instead, one should first use std::vector<>
Unless performance actually is measured to be significantly different, std::vector<> should be the 'go to' solution. People often think they have a case where a list is better, but once you start to count up times iterating the list vs times modifying it, std::vector<> is almost always better in practice.
Good point. We were focussed too much on choosing between GSList, boost::ptr_list, and std::list.
-Johan