
Hi, is their going to be an overload for ptr_container to be able to work well with back_insert_iterator, front_insert_iterator and insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without worrying about the range of ptrVectorB.

chun ping wang skrev:
Hi, is their going to be an overload for ptr_container to be able to work well with back_insert_iterator, front_insert_iterator and insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without worrying about the range of ptrVectorB.
It's too late for 1.35, but I will think about adding them to the trunk. -Thorsten

hmm k so which header(s) file will change? On Jan 21, 2008 12:57 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
chun ping wang skrev:
Hi, is their going to be an overload for ptr_container to be able to work well with back_insert_iterator, front_insert_iterator and insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without worrying about the range of ptrVectorB.
It's too late for 1.35, but I will think about adding them to the trunk.
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

chun ping wang skrev:
hmm k so which header(s) file will change?
I expect this to be new header files. In the eman time, can you post your envisioned usage example? Thanks -Thorsten
On Jan 21, 2008 12:57 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com <mailto:thorsten.ottosen@dezide.com>> wrote:
chun ping wang skrev: > Hi, is their going to be an overload for ptr_container to be able to > work well with back_insert_iterator, front_insert_iterator and > insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without > worrying about the range of ptrVectorB.
It's too late for 1.35, but I will think about adding them to the trunk.
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

boost::ptr_vector<Plant> A; // pointer to vector of Animal // fill in A. boost::ptr_vector<Plant> B; // pointer to vector of Animal std::copy(A.begin(), A.end(), B.begin()); // it does not neccessary have to be copy, any algorithm requiring an output iterator would be fine. On Jan 24, 2008 2:25 AM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
chun ping wang skrev:
hmm k so which header(s) file will change?
I expect this to be new header files.
In the eman time, can you post your envisioned usage example?
Thanks
-Thorsten
On Jan 21, 2008 12:57 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com <mailto:thorsten.ottosen@dezide.com>> wrote:
chun ping wang skrev: > Hi, is their going to be an overload for ptr_container to be able to > work well with back_insert_iterator, front_insert_iterator and > insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without > worrying about the range of ptrVectorB.
It's too late for 1.35, but I will think about adding them to the trunk.
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

sorry it should have been std::copy(A.begin(), A.end(), std::back_inserter(B.begin())); On Jan 24, 2008 5:14 AM, chun ping wang <cablepuff@gmail.com> wrote:
boost::ptr_vector<Plant> A; // pointer to vector of Animal // fill in A. boost::ptr_vector<Plant> B; // pointer to vector of Animal
std::copy(A.begin(), A.end(), B.begin()); // it does not neccessary have to be copy, any algorithm requiring an output iterator would be fine.
On Jan 24, 2008 2:25 AM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
chun ping wang skrev:
hmm k so which header(s) file will change?
I expect this to be new header files.
In the eman time, can you post your envisioned usage example?
Thanks
-Thorsten
On Jan 21, 2008 12:57 PM, Thorsten Ottosen < thorsten.ottosen@dezide.com <mailto: thorsten.ottosen@dezide.com>> wrote:
chun ping wang skrev: > Hi, is their going to be an overload for ptr_container to be able to > work well with back_insert_iterator, front_insert_iterator and > insert_iterator. Like i can copy from ptrVectorA to ptrVectorB without > worrying about the range of ptrVectorB.
It's too late for 1.35, but I will think about adding them to the trunk.
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

well merge, union, intersection algorithm.. On Jan 24, 2008 7:04 AM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
chun ping wang skrev:
sorry it should have been std::copy(A.begin(), A.end(), std::back_inserter(B.begin()));
A better alternative to std::copy() is
B.insert( B.begin(), A );
Did you have any other algorithm in mind?
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

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

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@dezide.com> 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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
chun ping wang
-
Thorsten Ottosen