Boost logo

Boost Users :

From: Allen Cronce (acronce_at_[hidden])
Date: 2005-09-30 10:50:10


Hi Thorsten,

Thanks for getting back to me. Unless I'm missing something, the examples indicate that a clone of an object is inserted when passed by reference. Please see the example page here:

http://www.boost.org/libs/ptr_container/doc/examples.html#id6

--snip--
5. Objects are cloned before insertion, inserted pointers are owned by the container
class X { ... };                     // assume 'X' is Clonable
X x;                                 // and 'X' can be stack-allocated
ptr_list<X> list;
list.push_back( x );                 // clone 'x' and then insert the resulting pointer
--snip--

Best regards,
--
Allen Cronce

Thorsten Ottosen wrote:
Allen Cronce <acronce <at> earthlink.net> writes:

  

No one responded to this so I'm sending it again.
I understand that the work around is to not use stack objects. But the
documentation indicates that this should work.
    

Ok, could you point to the documentation where this is stated, so I can remove
it?

It's not right; as can be seen from, only T* arguments are accepted by
push_back (in the next release auto_ptr<T> is probably supported too)

http://www.boost.org/libs/ptr_container/doc/ptr_sequence_adapter.html

br

Thorsten

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
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