Re: Quick Question: How can I get the GTypeInfo from a GType?

On Thu, Jan 08, 2004 at 11:33:52AM -0700, Ryan McDougall wrote:
> On Thu, 2004-01-08 at 09:04, Owen Taylor wrote:
> > On Wed, 2004-01-07 at 22:38, Ryan McDougall wrote:
> > > Specifically I want to be able to look up how large the object is, for
> > > pointer arithmetic, if only given a GType. Doesn't appear to be any
> > > obvious way.
> > 
> > Can you be more specific about what you are doing? I can't
> > think of any reason to do this that wouldn't be entirely
> > incorrect and dangerous.
> > 
> > Regards,
> > 					Owen
> >  
> As I read through the source codes lots of good and bad ideas pop into
> my head. Right now I am thinking about implementing an Iterator object
> for use in a STL style container system. I think the APIs for GList,
> GArray, GTree, etc can be simplified and enriched by using some ideas
> from STL's design. Of course C has no easy way to fake C++'s Generic
> programming, but there may be yet some stuff that will transfer over.
> Aside: How efficient is GValue for faking Generic Programming?
> Since pointers are iterators I want to see if I can create
> implementations of the iterator models In/Out, Fore/Back, Random Access,
> etc via an interface GIterator that has methods (respective to the
> above) peek/poke, next/prev, goto, etc. If the iterator doesnt support
> some operation (lets say poke, because its a read-only Output Iterator),
> then the method is NULL. Basically the implementation for contiguous
> memory would be pointer arithmetic on void pointers using the size of
> the object. For things like linked lists, and trees, someone would have
> to make sure the method points to something like g_list_forward_iter(),
> or g_tree_depthfirst_iter(), instead of g_array_iter().
> Its all pretty fluid and in my head since Im not sure how good an idea
> it is... What do you think?

FYI, there's been discussion (and an implementation) of iterators before:


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