From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-10-05 18:32:35
Thanks for your review.
| Here's my review. I believe the Smart Container library should be ACCEPTED.
| have some suggested modifications, but there is only one issue which I think
| needs to be resolved before I can give the library my unconditional approval
| (item 5 under "evaluation of the design"). Since I did not have time to
| the implementation, my yes vote depends on other reviewers having done so
| found it acceptable.
Thanks...am sure we can solve those issues.
| > * What is your evaluation of the design?
| Very good, on the whole. I have these comments (in no particular order):
| 1. The functions used in the definition of Clonable are not well named. I
| prefer either
| - allocate_clone/deallocate_clone or construct_clone/destroy_clone, to
| the interface of standard allocators, or
| - something using new/delete, as someone else suggested
yeah, there is some inconsistency here.
| 2. It's a bit odd that CloneManager uses operator() to destroy objects. I
| understand that this is a requirement of using CloneManager as a deleter,
| you could easily use an adapter instead.
| 3. I think Cloner sounds better than CloneManager. Cloner is already an
| word; CloneManager sound like a mixed metaphor.
As I mentioned in another mail, and as sugeested by Pavol, it would probably
be better to
rip CloneManager apart into Allocator and CloneAllocator
| 4. Since performance is one of the main design goals, I'm suprised that
| attempting to insert a null pointer causes an exception rather than an
| failure. The same goes for invoking the functions for back, front, pop_back
| pop_front with an empty container. By coincidence, this morning I was
| experimenting with some code that invokes a function pointer with a pointer
| argument, like so
| in an inner loop. I tried replacing the above code with
| if (p_)
| throw std::runtime_error(...);
| I found an enormous slowdown, which should be no surprise.
yeah, I dunno, this might depend heavily on the compiler. what compiler do you
At least for back()/front() you can avoid a check by
For vector/deque you can unchecked random access too via operator().
It is is true that performance was a design goal, but so was safety. The
domain of pointers
allowed me to do different trade-offs than with standard containers. For
it really matter if container.push_back( new T ) throw if 0 was inserted? IMO
the heap operation will dwarf any other operation by several magnitudes.
The same considerations would be true for eg. pop_back() when calling the
on the object since we need to remove the object from the heap.
| 5. The caveat "splice()/merge() in ptr_list is not thought through yet"
| very nervous. What aspect needs to be thought through? Does the current
| implementation have well-defined semantics? I have not examined the
| implementation, so I can't answer these questions, but whatever the caveat
| means, resolving it should be a condition of acceptance.
yes, I understand your concern and I promise to find a solution to this. It's
each function needs to be faily carefully examined to see if its specs can
potentially lead to leaks
and other problems. I just didn't have the time, and I thought the review
could work without people
worriying too much about splice().
| 6. To answer possible review issue 13, I'd say you should parameterize the
| provided clone managers by allocator type, defaulting to std::allocator<
| [unspecified] >.
why unspecified instead of T* ?
| 7. I don't understand review issue 10. I don't see the erase()/insert()
| functions that return pair<iterator, bool>.
in set/map and ptr_set/ptr_map these functions returns this pair to say "we
did/did not insert the element".
I think that the same should hold for transfer; it would be only natural.
Another way would of course to return
| 9. For possible review issue 5, theoretcially I'd like to see auto_type
| as move_ptr. (I now like Howard Hinnant's suggested "unique_ptr", though he
| seems to be leaning toward "sole_ptr" now.) Then you could also use move_ptr
| where you now use auto_ptr. However, I agree with one of the other reviewers
| said that this would really be appropriate only if move_ptr were a
| library. I haven't proposed move_ptr mainly because I'm not sure whether it
| be made obsolete by policy_ptr and because while there was a great deal of
| discussion in January, there wasn't much comment after I posted my recent
yeah, we'll wait and see.
| 10. If ptr_iterators are kept, I agree that there needs to be a much more
| detailed explanation of which algorithms they can be used with.
| > * What is your evaluation of the implementation?
| The parts I looked at looked good, but that means little since I only gave
| quick glance.
| > * What is your evaluation of the documentation?
| It was hard to find my way around in the documentation. In general, there
| of boost, so you might consider using it ;-) Here are some more detailed
| comments, in no particular order:
yes, good idea.
[I have snipped most of your detailed comments, but I will look into them]
| 6. On mozilla, some of the preformatted text overflows the bounding box,
| in "3. Copy-semantics of smart containers"
hm...yeah, I don't really know why it does that.
| 10. British and American cows say "Moo".
| 11. Sound that pigs make, according to google:
| oink - 160,000 hits
| > * What is your evaluation of the potential usefulness of the library?
| Extremely useful.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk