Здравствуйте, noodles, Вы писали:
N>>>The C++ Programming Language, Third Edition, Bjarne Stroustrup. Упоминается такое в паре мест.
СМ>>ты бы цитату привел, Старуструп большой
N>Стр.92
N>"Taking a pointer to the element one beyond the end of an array is guaranteed to work. This is N>important for many algorithms (§2.7.2, §18.3). However, since such a pointer does not in fact point N>to an element of the array, it may not be used for reading or writing. The result of taking the N>address of the element before the initial element is undefined and should be avoided. On some N>machine architectures, arrays are often allocated on machine addressing boundaries, so ‘‘one before N>the initial element’’ simply doesn’t make sense."
Эта цитата говорит об исполдьзовании памяти вне массива. А у нас случай другой. У нас индекс -1, а выходит ли он за границы массив — неизвестно.
Незачет.
N>Интересно, что это учитывается в реализации обратных итераторов reverse_iterator<Iter>, стр.557.
СМ>>это нельзя a[-1]; но по тексту неясно как псе это описано. так что выводы делать рано
N>Согласен. Делать выводы по тому куску кода скорополительно. Признаю. Но проверять нужно.