Re: Converting a Glib::ValueBase to a derived type
- From: Murray Cumming <murrayc murrayc com>
- To: José Alburquerque <jaalburquerque cox net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Converting a Glib::ValueBase to a derived type
- Date: Wed, 30 Jan 2008 20:54:09 +0100
On Wed, 2008-01-30 at 14:48 -0500, José Alburquerque wrote:
> >> Don't do that
> >> ( Glib::ValueBase get_something() )
> >>
> >> Do this:
> >> void get_something(Glib::ValueBase& value);
> >>
> >> Then it's up to the caller to pass the correct type, and it's up to the
> >> get_something() to complain at runtime if it's not the correct type.
> >>
> >> See, for instance, Gtk::TreeModel
> >>
> > I see; it works better returning value in reference. Thanks.
> >
> I forgot to ask: How would the "get_something()" know if the value
> returned is of the right type?
I'm not quite sure what you are asking, and the answer probably depends
on what you are doing? I guess you are trying to wrap a particular C
function. Which one?
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]