
21 Jan
2014
21 Jan
'14
5:54 p.m.
2014/1/21 Martin Owens <doctormo@...400...>:
Ah man, I just got it working with GSList and boost looks like a dogs breakfast of spaghetti code. Do I /have/ to use boost or can std::list do the job too? (not example in the code of boost::ptr_list, very unsafe to try and implement)
I'm not sure what you mean by boost::ptr_list being unsafe.
boost::ptr_list<T> works almost exactly like a std::list<std::unique_ptr<T>>, but iterators dereference to object references.
boost::intrusive::list allows you to compute an iterator to the element from the element itself in constant time, so it is very useful if an object needs to remove itself from the list.
Regards, Krzysztof