문제

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?

도움이 되었습니까?

해결책

Clean, Restart XCode, Clean, then Rebuild.

다른 팁

It looks like Array::const_iterator is of type int. You cannot dereference an int (in contrast to a pointer or STL iterator).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top