From: Ralph T. <ra...@gm...> - 2006-10-11 17:08:19
|
Hi, I'm not sure if this is possible, but... is there a way to put an instance of some class into a value_t and then later pull out regular_interfaces on it? Something like this: struct widget { // from View void display(const type_t&); // from Controller void monitor(monitor_fn_t); ... }; value_t v(new widget()); any_view_t* view = v.get<any_view_t*>(); any_controller_t* controller = v.get<any_controller_t*>(); The problems I have where this would be useful are typically wrapping an API that defines a type for "a group of objects that can be enumerated" (which I would have to convert to an array_t) and provides some special operations on the group type (so I'd also have to have the specific group type available). Of course, I can also solve this problem by providing a conversion function, but this seemed more interesting :). Thanks, Ralph -- "i have a dream and it's called a crossbar switch/what this will mean is no big data glitch" |