Murray Cumming wrote:
On Wed, 2008-01-30 at 14:48 -0500, José Alburquerque wrote:I'm looking at the todo comments in lines 65 and 71 of the structure.hg file (in gstreamermm). I'm attempting to define the getter methods of the Gst::Structure along with the id_get_value() method (commented definition) correctly.I forgot to ask: How would the "get_something()" know if the value returned is of the right type?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::TreeModelI see; it works better returning value in reference. Thanks.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?
-Jose