Re: [gtkmm] get a reference from a Gtk::TreeValueProxy

On Fre, 2003-01-31 at 10:55, erwan ancel wrote:
> > So it would be best to store the pointer. If you are worried about the
> > efficiency of copying by value then you shouldn't encourage the TreeView
> > to do it internally either.

The best is to use a smart pointer, there are plenty of them around.


> > You might like to patch TreeValueProxy in gtkmm 2.4 to allow
> > get-a-pointer-or-reference-to-the-value.

No way.  Due to the necessary translation from the C interface to C++,
temporaries have to be created and returned by value.  This is a
documented Glib::Value<> restriction.  (Granted, the TreeModelColumn<>
documentation doesn't mention that it's implemented via Glib::Value<>.)

And are you sure your problem is really operator=() ?  This would be
quite unusual since most types implement both copy construction and copy
assignment if they're copyable at all.

All STL containers require a copy constructor.  Copy assignment is not
needed by all operations, but generally advisable.  Gtk::TreeModel has
the same policy with the only restriction that copy assignment is always

So, is your type actually usable with STL containers?


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