boost-users [pointer containers] stl set_unions
is it possible to use stl set_unions with ptr_container or do I have to hand roll my own. if yes what inserter should i use or how would i use two containers having pointer of int ptr_vector<int> a1; ptr_vector<int> a2; have a1 union a2 and store in a3.
chun ping wang skrev:
is it possible to use stl set_unions with ptr_container or do I have to hand roll my own. if yes what inserter should i use or how would i use two containers having pointer of int ptr_vector<int> a1; ptr_vector<int> a2;
have a1 union a2 and store in a3.
Should be possible, but you need a different out-put iterator compared to e.g. std::back_inserter( a_normal_container ). Specifically, you need to call a3's clone_allocators' allocate_clone() in the call to push_back(). -Thorsten
hmm can you give a small example of what you mean.. calling
clone_allocators' allocate clone
On Nov 28, 2007 5:38 AM, Thorsten Ottosen
chun ping wang skrev:
is it possible to use stl set_unions with ptr_container or do I have to hand roll my own. if yes what inserter should i use or how would i use two containers having pointer of int ptr_vector<int> a1; ptr_vector<int> a2;
have a1 union a2 and store in a3.
Should be possible, but you need a different out-put iterator compared to e.g. std::back_inserter( a_normal_container ).
Specifically, you need to call a3's clone_allocators' allocate_clone() in the call to push_back().
-Thorsten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
chun ping wang skrev:
hmm can you give a small example of what you mean.. calling clone_allocators' allocate clone
Calling new_clone() is probably sufficient for most purposes. -Thorsten
On Nov 28, 2007 5:38 AM, Thorsten Ottosen
mailto:thorsten.ottosen@dezide.com> wrote: chun ping wang skrev: > is it possible to use stl set_unions with ptr_container or do I have > to hand roll my own. > if yes what inserter should i use or how would i use two containers > having pointer of int > ptr_vector<int> a1; > ptr_vector<int> a2; > > have a1 union a2 and store in a3.
Should be possible, but you need a different out-put iterator compared to e.g. std::back_inserter( a_normal_container ).
Specifically, you need to call a3's clone_allocators' allocate_clone() in the call to push_back().
-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
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
hmm yeah i want to be able to store them in ptr_vector<int> a3.
Since this doesn't work.. you think their would be future work around to
support integeration with stl algorithms.
On Nov 28, 2007 2:44 PM, Thorsten Ottosen
chun ping wang skrev:
hmm can you give a small example of what you mean.. calling clone_allocators' allocate clone
Calling new_clone() is probably sufficient for most purposes.
-Thorsten
On Nov 28, 2007 5:38 AM, Thorsten Ottosen
mailto:thorsten.ottosen@dezide.com> wrote: chun ping wang skrev: > is it possible to use stl set_unions with ptr_container or do I have > to hand roll my own. > if yes what inserter should i use or how would i use two containers > having pointer of int > ptr_vector<int> a1; > ptr_vector<int> a2; > > have a1 union a2 and store in a3.
Should be possible, but you need a different out-put iterator compared to e.g. std::back_inserter( a_normal_container ).
Specifically, you need to call a3's clone_allocators' allocate_clone() in the call to push_back().
-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
------------------------------------------------------------------------
_______________________________________________ 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
chun ping wang skrev:
hmm yeah i want to be able to store them in ptr_vector<int> a3.
Since this doesn't work.. you think their would be future work around to support integeration with stl algorithms.
If you were to implement output iterators for ptr_containers, I would be happy to include it. The planned void* -> T* implementation will also make it easier to use some stl algorithms. But notice most algorithms use Copyability, something not usually supported by polymorphic types. -Thorsten
participants (3)
-
chun ping wang
-
Jeff Flinn
-
Thorsten Ottosen