
12 May
2006
12 May
'06
7:09 p.m.
Grisha Spivak wrote:
<snip>
it[2] = -22; it[3] = it[5]; std::cout << arr[2*2] << ' ' << arr[3*2] << ' ' << arr[5*2] << '\n';
It prints "-22 33 55" instead of "-22 55 55" (which I expected) - so "it[3] = it[5];" assignment didn't modifies array. Is it intended behaviour? Or maybe I'm doing something wrong?
If you change it[3] = it[5]; with it[3] = 55; it will work. The problem is your iterator_facade::operator[] returns a boost::detail::operator_brackets_proxy which, I'm not sure why, does not seem to implement operator=(operator_brackets_proxy const &). There may be a good reason for this but perhaps the author(s) of the library can answer that. -delfin