|
Boost : |
From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2006-04-23 10:27:34
> That's not clear to me at all. There's no inherent good in avoiding
> dependencies among Boost libraries. It's a judgement call, based on
> many factors, including the author's personal preference. You have
> every right to make that call yourself, but if you're trying to
> somehow *justify* your decision, IMO so far you haven't said anything
> that demonstrates it to be the best one.
The reason why ptree does not use multi index is because implementation
existed long before I considered submitting to boost, probably before even I
knew of multi index existence. It was working well. Later, when I was
improving it during pre-review process, I seriously considered using
multi-index. But I decided it is not worth throwing everything out.
Although ptree has large interface with many functions modifying state of
the tree, it uses "single point of change" approach. Every insert eventually
goes through one function, which takes care of exception safety and keeping
index in sync with data. The same applies to erase. This function has 9
lines of code in case of insert, and (by coincidence) also 9 in case of
erase. By using multi index these functions would obviously be simplified,
maybe to 4 lines each. Net gain: 10 lines of code (out of several hundred in
ptree_implementation.hpp).
I'm aware that there are performance gains to be reaped as well, but at that
time I was rather focusing on getting the interface right.
Best regards,
Marcin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk