Reputation: 393
This code
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;
}
produces the following error in Apple LLVM compiler 4.2:
Indirection requires pointer operand ('Array::const_iterator' (aka 'int') invalid)
However, if I compile this code in LLVM GCC 4.2, it works fine. Any ideas?
Upvotes: 0
Views: 518
Reputation: 17026
It looks like Array::const_iterator
is of type int
. You cannot dereference an int
(in contrast to a pointer or STL iterator).
Upvotes: 1