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



On 6/2/06, Murray Cumming <murrayc murrayc com> wrote:
On Sat, 2006-06-03 at 00:39 +0200, Pierre THIERRY wrote:
> Scribit Joe Van Dyk dies 02/06/2006 hora 12:58:
> > However, it fails to compile -- something about the copy ctor.
>
> Try to store pointers (or Glib::Refptr) of widget, they are assignable,
> AFAIK.

Please don't use Glib::RefPtr on widgets. It's not what it's meant for.
A regular pointer is fine.

> The value type of an STL container must be assignable. It must also be
> default constructible when you want to reserve space, I think.

I haven't looked at the gtkmm documentation in a while, so forgive me
if this is answered there.

Are Gtkmm widgets not copyable, in general?

Imagine I have fifty Players.  Players have a Type, and a X/Y/Z
position.  I'm drawing a 2D overhead display of the Players using the
Gnome Canvas widget.  The icons are based on the Player type, and when
the X/Y/Z positions of each Player change, their icon on the canvas
moves.

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?

Joe



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