12 Jan
2008
12 Jan
'08
9:34 p.m.
AMDG nicola wrote:
There is more than that, however: as you can see in my original post, get_record() and seekg() are not const and that is a problem because they are invoked by dereference(). I can compile successfully if I const-qualify them, but this is not correct in my opinion. The fact is, they do change the state of the object in a visible way.
OK. Since begin and end return handles to the class that allow its state to change they should not be const. If they absolutely need to be const then you need to reset the the seek position after you use it. You can create private const versions get_record and seekg for this purpose. In Christ, Steven Watanabe