Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-11 19:59:12


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net