Jonathon I have enjoyed following the discussion about introducing a generic TreeModel class. Using a template class is a great idea for it sure would make it easy to initialize the class with STL containers. I have some few notes first if the basic idea was to keep only one copy of data around, you may think of using a reference to the wrapped container.
>private: > T m_container; can be: T& m_container; this will allow two-way updates to be automatically sensed on both the view and model sides. Second you may consider declaring your template parameters like this: template < class T, template < class U, class = allocator <U> > class TContainer> this makes your class instantiated with both the container and the type it is storing. I just guess that this may come handy later on. In this case the member variable should look like this: TContainer<T>& m_container; Another approach that should make your implementation more generic, is to use iterators to initialize the class rather than a whole container. This would allow the class to accept a wider range of containers (even arrays and pointers). Though this can be problematic, (After thinking this won't work for the purpose at hand). Last point is the question, should the user inherit from your class or not? Well, it is there and it has virtual functions and some will do so even if you provided some other alternative. Still for the sake of better view/model separation it should be better that they don't. You will still need to acquire columns' values from the user as well as communicating back the mutations performed on these values through the UI. One way to do that is to use some helper class let's say ValuesProvider. The user can inherit from it and supply a pointer/reference to your class that can call the helpers functions to get values for each row of data (or each column individually) as this is needed. It can pass an iterator over the container. If you have a reference to the container rather than a copy such iterators will be valid ones. By the way this approach is used in the java API of eclipse namely in the jface package. Some other approach is to use signals that the user can connect to and supply column values through his slots. In both cases you should use a generic type to receive the values which would be Glib::ValueBase since it is catually the type used in the vfunc in your class anyway. I hope these notes are not totally out of point. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list