Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2008-01-28 09:07:37


hey thanks, it works. I haven't tested on the effiency of it yet though.

On Jan 24, 2008 2:34 PM, Thorsten Ottosen <thorsten.ottosen_at_[hidden]>
wrote:

> Thorsten Ottosen skrev:
> > chun ping wang skrev:
> >> well merge, union, intersection algorithm..
> >
> > merge() is there as a member function, the others are not.
> >
> > I'll put boost::clone_back_inserter() or boost::ptr_back_inserter()
> > on my todo. They are not hard to do.
>
> I've uploaded boost/ptr_container/clone_inserter.hpp to trunk.
>
> Here's the synopsis:
>
> namespace boost
> {
> namespace ptr_container
> {
> template< class PtrContainer >
> class clone_back_insert_iterator;
>
> template< class PtrContainer >
> class clone_front_insert_iterator;
>
> template< class PtrContainer >
> class clone_insert_iterator;
>
> template< class PtrContainer >
> clone_back_insert_iterator<PtrContainer>
> clone_back_inserter( PtrContainer& cont );
>
> template< class PtrContainer >
> clone_front_insert_iterator<PtrContainer>
> clone_front_inserter( PtrContainer& cont );
>
> template< class PtrContainer >
> clone_insert_iterator<PtrContainer>
> clone_inserter( PtrContainer& cont,
> typename PtrContainer::iterator before );
> }
> }
>
> Each iterator defines three different versions of operator=(), because
> there are slightly different situations to handle,e.g. for
> clone_back_insert_iterator:
>
> clone_back_insert_iterator&
> operator=( typename PtrContainer::value_type r );
>
> template< class T >
> clone_back_insert_iterator&
> operator=( std::auto_ptr<T> r );
>
> clone_back_insert_iterator&
> operator=( typename PtrContainer::const_reference r )
>
> The first copies null's correctly. he second can be used with a moving
> transform iterator. The third is most handy, but requires a container
> without nulls. Some examples:
>
> std::copy( boost::make_transform_iterator( seq.begin().base(),
> caster_to<int*>() ),
> boost::make_transform_iterator( seq.end().base(),
> caster_to<int*>() ),
> ptr_container::clone_back_inserter( seq2 ) );
>
>
> std::copy( seq3.begin(), seq3.end(),
> ptr_container::clone_inserter( seq, seq.end() ) );
>
> Let me know what you think
>
> best regards
>
> -Thorsten
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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