[gtkmm] A const_iterator for TreeModel?

I was half-way through implementing the const_iterator,
reverse_iterator, and const_reverse_iterator for TreeModel:

Then I released that, even with a std::list, you can't do
  std::list::iterator iter_non_const;
  std::list::const_iterator iter_const = iter_non_const;
either explicitly or implicitly.

But you would want to use them in almost all the same places, so any
  do_something(const iterator& iter);
method would need
  do_something(const const_iterator& iter);
  do_something(const reverse_iterator& iter);
  do_something(const const_reverse_iterator& iter);

And that would get ridiculous quite quickly, and really problematic when
dealing with virtual methods that should be overridden. Am I
misunderstanding something? I can't think of a good example in the
standard C++ library - things like std::find are templates.

Murray Cumming
murrayc murrayc com

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