[gtkmm] TreeModel::const_iterator - too difficult



As I explain here:
http://bugzilla.gnome.org/show_bug.cgi?id=134520

I give up implementing TreeModel::const_iterator for now, because it
seems too difficult, and maybe not worth it. Or does anyone have greater
wisdom?

This is what I say in the bug:

"
TreeRow currently inherits from TreeIter so that we can cast a TreeRow
to a TreeIter, so we can return a TreeRow pointer or reference from
TreeIter::operator* and TreeIter::operator->, without complicated
memory management. But TreeRow can only have one base class (iterator)
and that will not allow us to cast to a TreeRow from a
const_itearator. TreeNodeChildren does the same inheritance trick.

Possible solutions for this are:
1. Make TreeRow and TreeNodeChildren templates as well? But what
should the template types be? The half-finished patch
(gtkmm_treemodel_constiter2.patch) tries this, but
  template<_Tp, _Ref, _Ptr>
  class TreeRow : public TreeIter<_Tp, _Ref, _Ptr>
is problematic when _Tp is itself TreeRow. This seems like a recursive
declaration.

2.
Have a TreeRow (and maybe a TreeNodeChildren) instance in every
TreeIter instance? But that would be slow, I think.
"

-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com




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