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 12:38:54 +0100
On Tue, 2008-01-29 at 23:48 -0500, José Alburquerque wrote:
> I'm wondering, would anyone know how to convert a Glib::ValueBase to one
> of its derived types (such as Glib::Value<int>) assuming the derived
> type has been returned from a function as the base class
> Glib::ValueBase?
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'm writing some code that would conveniently return a
> derived Glib::ValueBase as a Glib::ValueBase and really don't know how
> to convert it back to the derived type once it's been returned. Thanks.
>
> -Jose
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]