Boost logo

Boost Users :

From: Sergey Sadovnikov (flex_ferrum_at_[hidden])
Date: 2008-05-05 18:16:39


Hello, Thorsten.

Monday, May 5, 2008 at 10:30:21 PM you wrote:

TO> Sergey Sadovnikov skrev:

TO> The code in trunk changed after we could patch the release branch. Could
TO> you please check that code to see if it is still surprising to you?
Trunk code is still surprising me. :) If boost::ptr_sequence_adapter::erase_if has to guarantee
standard std::list::remove_if behavior (for ptr_list container, of
course) it should be overridden in the ptr_list
class. For example, in this way:

    template
    <
        class T,
        class CloneAllocator = heap_clone_allocator,
        class Allocator = std::allocator<void*>
>
    class ptr_list /* ... */
    {
      public:
//...
        template< class Pred >
        void erase_if( Pred pred )
        {
            this->base().remove_if(void_ptr_delete_if<Pred,value_type>(pred));
        }
//...
    };

This code corresponds all my expectations. :)

Another way is what ptr_list should offer its own implementation of remove_if
algorithm (as it already offers sort and merge algorithms) for
compatibility with std::list interface.

-- 
Best Regards,
 Sergey                          mailto:flex_ferrum_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net