The review of Ion Gaztañagas's Intrusive library begins today,
March 12, and extends up to March 21.
* Download:
Boost vault: http://boost-consulting.com/vault/
Folder: Containers
File: intrusive.2007-03-04.zip
* Online docs:
http://ice.prohosting.com/newfunk/boost/libs/intrusive
* Description: Intrusive is a library presenting some intrusive
containers to the world of C++. While intrusive containers were
and are widely used in C, they became more and more
forgotten in C++ due to the presence of the standard containers,
which don't support intrusive techniques. Intrusive not only
reintroduces this technique to C++, but also encapsulates the
implementation in STL-like interfaces. Hence anyone familiar
with standard containers can easily use Intrusive. Like their
STL-counterparts, intrusive containers use template parameters
to control the stored data types and some special aspects of
intrusive containers.
* Compilers tested (so far):
Visual 7.1/WinXP
Visual 8.0/WinXP
GCC 4.1.1/MinGW
Intel 9.1/WinXP
GCC 4.1.2/Linux
* Review questions: Here are some questions you might want
to answer in your review:
- What is your evaluation of the design?
- What is your evaluation of the implementation?
- What is your evaluation of the documentation?
- What is your evaluation of the potential usefulness of the
library?
- Did you try to use the library? With what compiler? Did
you have any problems?
- How much effort did you put into your evaluation? A glance?
A quick reading? In-depth study?
- Are you knowledgeable about the problem domain?
And finally, every review should answer this question:
- Do you think the library should be accepted as a Boost library?
Be sure to say this explicitly so that your other comments don't
obscure your overall opinion.
I invite you to submit your review, either publicly to the developers
or the users lists, or else, if for whatever reason you don't want to
publicize it, directly to me. Thank you for investing some of your
time on reviewing Ion Gaztañaga's Intrusive library.
The Review Manager,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Review of Intrusive Container library
- What is your evaluation of the design?
I like it pretty much. As far as I can see, it is
a clear and flexible design. I'm especially happy
about the thoughts expressed in "Design Notes".
- What is your evaluation of the implementation?
I did not really check the implementation.
- What is your evaluation of the documentation?
Clear and well structured.
It was easy to use the ilist container based on this documentation.
The only information I missed when using ilist as
described below was a specification of iterator
behavior under insertion and deletion. I expect
the same guarantees as for node based STL
containers, but of course this should be
explicitly stated.
- What is your evaluation of the potential usefulness of the library?
Very useful. Intrusive containers have their
place without doubt and having an STL-style and
-quality library with great flexibility is a big
win in my eyes.
- Did you try to use the library? With what compiler? Did you have
any problems?
I converted some code using a proprietary double
linked list template to ilist using auto unlink
hooks. This went without problems (besides the
usual typos).
The code was compiled with CodwWarrior 9 under Mac OS X 10.4.8.
I intend to leave this code as it is now and
convert other double linked lists to ilist over
time, too.
- How much effort did you put into your evaluation? A glance?
A quick reading? In-depth study?
I read about 70% of the non-reference part of the
documentation with a bias towards double linked
lists.
My experiment with ilist is described above.
I had only a glance at the source code.
- Are you knowledgeable about the problem domain?
Not really beyond linked lists.
- Do you think the library should be accepted as a Boost library?
Definitely yes.
Regards,
Kai Brüning
--
Kai Brüning * Geschäftsführer
RagTime GmbH * http://www.ragtime.de
Neustraße 69 * 40721 Hilden * Deutschland
Tel: [49](0)2103 9657-0 * Fax: [49](0)2103 9657-96
Sitz der Gesellschaft: Hilden * Amtsgericht Düsseldorf HRB 45697
Geschäftsführer: Kai Brüning, Helmut Tschemernjak
- What is your evaluation of the design?
I like it pretty much. As far as I can see, it is
a clear and flexible design. I'm especially happy
about the thoughts expressed in "Design Notes".
The only information I missed when using ilist as
described below was a specification of iterator
behavior under insertion and deletion. I expect
the same guarantees as for node based STL
containers, but of course this should be
explicitly stated.
Ok. Yes, the guarantees are the same but I agree that iterator
invalidation information should be there.
"Joaquín Mª López Muñoz"
The review of Ion Gaztañagas's Intrusive library begins today,
(late review, I didn't read any other reviews for the library so far)
I support inclusion of the library into Boost.
It is work of professional quality, as usual.
/Pavel
Things that may be changed:
* I would personally remove complex and dangerous features
as destroying elements from containers and
copying and assigning containers.
If kept there should be big bold red blinking warnings
on the top of respective documentation, something as
"WHAT COULD GO WRONG HERE" + examples of how _not_ to do it.
More on this bellow.
* An vector-like pseudo-intrusive container may be added.
It is superfluous but people may like it more than lists.
(Is a map like intrusive container possible, btw?)
* More examples, e.g. one example per every combination of
hooks and containers, just to have something to copy, paste and play.
Advanced features may have more
examples, including failing ones.
The terms in the documentation may be more linked,
possibly the glossary may get page of its own.
Unsorted notes on the documentation are bellow.
================================================================
One existing library that implement intrusive containers is Data Object
Library
(http://www.codefarms.com/dol.htm, also http://www.codefarms.com/ptl.htm).
This library uses external, preprocessor like, tool to generate
code that handles lifetime management of the data.
It meansd that you create an object, add into into how many
containers you want and when it is removed from the last
container then it gets automagically deleted.
Author of the library claimed development time speedup 10x
comparing to classical manual lifetime management.
jjLib (http://sourceforge.net/projects/jjlib/)
is based on the same pronciples and also uses external
code generator.
What I imagine as potentially possible is for the
Intrusive Container library (or its complement)
to completely manage lifetime of inserted objects:
* when an object is removed from the last container
it gets automatically deleted.
I envision something as:
class MyData : private inserted_intrusive_containers_counter
{
boost::intrusive::ilist_member_hook<tag1> hook1;
boost::intrusive::ilist_member_hook<tag2> hook2;
boost::intrusive::ilist_member_hook<tag3> hook3;
public:
MyData()
: hook1(this), hook2(this), hook3(this) {}
};
and whenever the MyData instance is added to another container
an internal counter is incremented and whenever it is removed
the counter is decremented and when it reaches 0 it self-destroys.
ilist<MyData> l1, l2;
l1.push_back(*new MyData);
l2.push_back(*l1.begin());
l1.clear();
l2.clear(); // object gets deleted now
This would be somehow similar to the idiom recommended
by the people who wrote Ultima++ (containers are always the owners).
================================================================
Naming conventions:
* I would personally prefere names like boost::intrusive_slist.
The ilist is too easy to overlook and this type of naming is
used way too often to cause confusion.
* The code snippets should not use generic names as Vector or List
for the same reason.
* ilist_auto_base_hook etc.: it is not really clear whether the
class is intended to be base (it would end with _base).
Perhaps auto_removing_i[ntrusive_]list_base. The word "hook"
looks as unnecessary. The member hook may look like:
auto_removing_i[ntrusive_]list_support.
================================================================
Comments about documentation: they were written as I read the docs
for the first time so they look like recorded stream of consciousness.
________________________________________________________________
1. overview.html: the sentence
"On the other hand, an intrusive container does not store
copies of passed objects, but it stores the objects themselves."
may be better w/o using work store:
"On the other hand, an intrusive container does not insert
copies of passed objects, but it references the objects themselves,
without copying their data."
or so.
-------------
"If you want to share an object between two containers, you either
have to store multiple copies of those objects or you need to
use containers of pointers: std::list