Оператор косвенного обращения при ошибке const_iterator

Этот код

std::ostream& operator<<( std::ostream& output, const Array& a) {
if (a.empty()) {
output << Structural::BEGIN_ARRAY << Structural::END_ARRAY;

} else {
output << Structural::BEGIN_ARRAY << std::endl;
OutputFilter<Indenter> indent(output.rdbuf());
output.rdbuf(&indent);

for (Array::const_iterator i = a.begin(); i != a.end(); ++i) {
if (i != a.begin()) {
output << Structural::VALUE_SEPARATOR << std::endl;
}

output << *i; // <--- Error is here...

}

output.rdbuf(indent.getDestination());

output << std::endl << Structural::END_ARRAY;

}

return output;

}

выдает следующую ошибку в Apple LLVM 4.2:

Indirection requires pointer operand ('Array::const_iterator' (aka 'int') invalid)

Однако, если я скомпилирую этот код в LLVM GCC 4.2, он будет работать нормально. Есть идеи?

0

Решение

Очистить, перезапустить XCode, очистить, а затем восстановить.

1

Другие решения

Это выглядит как Array::const_iterator имеет тип int, Вы не можете разыменовать int (в отличие от указателя или итератора STL).

1