Boost C++ Libraries: Ticket #12764: Improve documentation regarding disposers https://svn.boost.org/trac10/ticket/12764 <p> The documentation about disposers in intrusive containers could be improved. </p> <p> Disposers are unusual in the sense that they deal with pointers to nodes whereas all the other intrusive container APIs deal with references to nodes. This point should be made clearer. </p> <p> For example, in: <a href="http://www.boost.org/doc/libs/1_63_0/doc/html/intrusive/erasing_and_disposing.html">http://www.boost.org/doc/libs/1_63_0/doc/html/intrusive/erasing_and_disposing.html</a> </p> <p> <code>remove_and_dispose_if</code> will call the "disposer" function object for every removed element. </p> <p> The documentation should emphasize that the element is passed to the disposer function by pointer, and not by reference. It is even more important in this example because <code>remove_and_dispose_if</code> also takes a predicate function taking elements by reference. So, we have a method <code>remove_and_dispose_if</code> taking two callbacks receiving elements in a different way: the predicate takes elements by reference, and the disposer takes elements by pointer. This is confusing and looks like a gratuitous inconsistency. This difference should be better explained, as well as the reason why disposers take elements by pointer and not by reference. </p> <p> Also in the same page: "Note that the disposing function does not need to just destroy the object. It can implement any other operation like inserting the remove object in another container. Let's see a small example..." </p> <p> But the example that follows doesn't show how to insert the removed object into another container. It shows how to destroy it with the delete operator. </p> <p> There is also a typo here. Change "the remove object" to "the removed object". </p> <p> Finally, this documentation should probably mention <a class="ext-link" href="http://en.cppreference.com/w/cpp/memory/default_delete"><span class="icon">​</span>std::default_delete</a>. It could be used in the example instead of rolling out our own function object calling the <code>delete</code> operator. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12764 Trac 1.4.3