Re: storing buttons in vector -- need to define copy ctor?



Scribit Joe Van Dyk dies 02/06/2006 hora 18:40:
> My initial approach would be to create fifty Gnome Canvas icons and
> stick them in a vector.  But I'd want pointers (not smart?) put in the
> vector?

I checked with a very small testcase, and vector indeed needs a copy
constructor. So yes, you'd want pointers instead. If you want to avoid
problems, you should use smart ones, like boost::smart_ptr<>[1]. I also
suggest you to use boost::indirect_iterator[2], which is an iterator
adaptor to be used on pointer containers (when you dereference it, you
get in fact the result of dereferencing it's content...).

Quickly,
Nowhere man
 
[1] http://www.boost.org/libs/smart_ptr/smart_ptr.htm
[2] http://www.boost.org/libs/iterator/doc/indirect_iterator.html
-- 
nowhere man levallois eu org
OpenPGP 0xD9D50D8A

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]