12 Jan
2008
12 Jan
'08
12:59 a.m.
AMDG nicola wrote:
Hi, I have a class modeling a record-based read-only binary file and I have written a random access iterator based on iterator_facade to iterate over the records. The class looks like this:
class my_binary_file {
<snip>
explicit my_binary_file_iterator(my_binary_file* ff, unsigned int n) : ff_ptr_(ff), rec_num_(n) { }
my_binary_file* is *not* const here.
<snip>
};
public: typedef my_binary_file_iterator iterator;
iterator begin() *const* { return iterator(this, 0); }
this is a pointer to const. The constructor of iterator requires a pointer to non-const. In Christ, Steven Watanabe