Re: Gtk::TreeModel::get_value_vfunc() constness

2013-10-02 Thread Kjell Ahlstedt
A cache is a kind of class member data that can very reasonably be 
declared *mutable*.
When the cache is changed, the physical state of the owning object 
changes, but its logical state, as seen by other objects, does not 
change. That's the kind of data that the *mutable* keyword is meant for.


Kjell

2013-10-01 23:38, Dominique Würtz skrev:

I'm implementing a custom Gtk::TreeModel for displaying database query
results. In order to avoid storing the entire result in memory, I'm
using a caching mechanism which stores only those rows in the
neighborhood of recently queried rows. In my get_value_vfunc(), if a
requested row is not in the cache, I need to update my cache.
Unfortunately, the get_value_vfunc() is declared const and thus forbids
mutating my TreeModel object which owns the cache. Any idea how to
resolve this?

Thanks!

Dominique



___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Gtk::TreeModel::get_value_vfunc() constness

2013-10-02 Thread Dominique Würtz
Am Mittwoch, den 02.10.2013, 09:33 +0200 schrieb Kjell Ahlstedt:
 A cache is a kind of class member data that can very reasonably be 
 declared *mutable*.
 When the cache is changed, the physical state of the owning object 
 changes, but its logical state, as seen by other objects, does not 
 change. That's the kind of data that the *mutable* keyword is meant for.
 
 Kjell
 

This makes sense and works as expected, thanks!


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list