[ptr_container]copy from one to other with iterator
I'm looking at ptr_vector to replace our wrapper around
vector
On 8/23/05, Thomas Matelich
I'm looking at ptr_vector to replace our wrapper around vector
. How do I correctly write the following: ptr_vector<T> a; ptr_vector<T> b; ... b.push_back(a.begin());
b.push_back(new T(*a.begin()));
Thanks, Tom
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Felipe Magno de Almeida Developer from synergy and Computer Science student from State University of Campinas(UNICAMP). Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br "There is no dark side of the moon really. Matter of fact it's all dark."
On 8/23/05, Felipe Magno de Almeida
On 8/23/05, Thomas Matelich
wrote: I'm looking at ptr_vector to replace our wrapper around vector
. How do I correctly write the following: ptr_vector<T> a; ptr_vector<T> b; ... b.push_back(a.begin());
b.push_back(new T(*a.begin()));
Thanks! Continuing my exploration into porting, I discovered that you cannot check equality of reverse_iterator and const_reverse_iterator. This is a regression compared to std::vector.
"Thomas Matelich"
On 8/23/05, Felipe Magno de Almeida
wrote: On 8/23/05, Thomas Matelich
wrote: I'm looking at ptr_vector to replace our wrapper around vector
. How do I correctly write the following: ptr_vector<T> a; ptr_vector<T> b; ... b.push_back(a.begin());
b.push_back(new T(*a.begin()));
Thanks!
I hope you know that can't just replace code using shared_ptr with ptr_container code...there's all kind of semanticdifferences. anyway good luck.
Continuing my exploration into porting, I discovered that you cannot check equality of reverse_iterator and const_reverse_iterator. This is a regression compared to std::vector.
that is certainly a problem...I'll look into this when I get some more time. Thanks Thorsten
On 8/23/05, Thorsten Ottosen
"Thomas Matelich"
wrote in message news:3944d4580508231010719a0ebc@mail.gmail.com... On 8/23/05, Felipe Magno de Almeida
wrote: On 8/23/05, Thomas Matelich
wrote: I'm looking at ptr_vector to replace our wrapper around vector
. How do I correctly write the following: ptr_vector<T> a; ptr_vector<T> b; ... b.push_back(a.begin());
b.push_back(new T(*a.begin()));
Thanks!
I hope you know that can't just replace code using shared_ptr with ptr_container code...there's all kind of semanticdifferences.
anyway good luck.
seems to be working okay so far. I'm trying to determine just how important shared copying is, and what the performance impace is. Just ran into my first non-trivial issue with no copy construction (I don't want cloning) :) Fun stuff.
"Thomas Matelich"
seems to be working okay so far. I'm trying to determine just how important shared copying is, and what the performance impace is.
it is quite big if you do it a lot.
Just ran into my first non-trivial issue with no copy construction (I don't want cloning) :) Fun stuff.
you prefer the containers to copy-constructible? -Thorsten
On 8/23/05, Thorsten Ottosen
"Thomas Matelich"
wrote in message news:3944d45805082312395ec6168c@mail.gmail.com... seems to be working okay so far. I'm trying to determine just how important shared copying is, and what the performance impace is.
it is quite big if you do it a lot.
Just ran into my first non-trivial issue with no copy construction (I don't want cloning) :) Fun stuff.
you prefer the containers to copy-constructible?
Well, I blew my 1 day exploration into replacing with ptr_vector
without learning much except that we copy these SmartVector's around a
lot, including returning them from functions. Unfortunately, we don't
do it very often in the unittests I was trying to do my timing with.
Anyway, my explorations did tell me that I think replacing our
vector
"Thomas Matelich"
you prefer the containers to copy-constructible?
Well, I blew my 1 day exploration into replacing with ptr_vector without learning much except that we copy these SmartVector's around a lot, including returning them from functions.
copying a ptr_vector can be very expensive...that is why you can release it auto_ptr< ptr_vector<T> > foo() { ptr_vector<T> vec; ... return vec.release(); }
Unfortunately, we don't do it very often in the unittests I was trying to do my timing with. Anyway, my explorations did tell me that I think replacing our vector
would probably work better as a shared_ptr<vector>. I'll look into it next time I have a day to blow. Thanks anyway for a cool library.
you're welcome. br Thorsten
"Felipe Magno de Almeida"
On 8/23/05, Thomas Matelich
wrote: I'm looking at ptr_vector to replace our wrapper around vector
. How do I correctly write the following: ptr_vector<T> a; ptr_vector<T> b; ... b.push_back(a.begin());
b.push_back(new T(*a.begin()));
b.push_back( new T( a.front() ) ); -Thorsten
participants (3)
-
Felipe Magno de Almeida
-
Thomas Matelich
-
Thorsten Ottosen