Re: Glib::Value<T> oddities



Am Mittwoch, den 02.10.2013, 20:14 +0200 schrieb Dominique Würtz:
My understanding is that Glib::Value (and GValue for that matter) is
something like boost::any, a container for values of arbitrary (well,
not really) type. Given this, the API to me loks awkward in so many
aspects, I thought I'd ask here about the reasoning behind some of the
design choices:

1. As the docs state clearly, I'm supposed to explicitly call the
init(GType) method to define the actual type of the value to be stored.

Glib::Value<int> x;
x.init(G_TYPE_INT);


I'd like to add, I realize there is no 1:1 relationship between all
GTypes and C-types. So it would make sense to add set_* (such as
set_boxed(...)) methods to the proposed Glib::Value class for each GType
which are direct wrappers around the g_value_set_* counterparts.




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