2013/4/22 Shriramana Sharma <samjnaa@...400...>:
Hello and thanks for replying.
On Mon, Apr 22, 2013 at 7:30 PM, Krzysztof Kosiński <tweenk.pl@...847...0...> wrote:
I wrote a custom container based on boost::intrusive::list.
Can you please point me to the exact location of this template in the source code? And is it like tied into Inkscape's internals in any way or easily adaptable to other value types.
src/ui/tool/node.h and .cpp, class NodeList. Note that this is not a template. It's "based on" boost::intrusive::list in the sense that the structure is the same - it doesn't actually use it. It would require some work to adapt it for use outside of Inkscape.
This kind of container works like a doubly-linked list and additionally allows one to obtain an iterator from a reference to an element in constant time, which is a very common operation required in Inkscape
Why would one want that particularly in a vector editing application?
The list members are control points and receive GUI events through callbacks, which are their member functions. You need to be able to get an iterator to the element from the reference to the element itself, because the element reference is all you've got within the callback. (This sounds a little convoluted but I hope you get the idea.)
Regards, Krzysztof