[LLVMbugs] [Bug 19425] ostream_iterator::operator* is not constant
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 14 10:48:40 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19425
Aleksej Lebedev <root at zta.lk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Aleksej Lebedev <root at zta.lk> ---
You are probably right.
It is very confusing though.
Operator * doesn't really modify the iterator. It is the same way as *p doesn't
modify p when p is a pointer.
It is legal to do this with pointers. The following code does compile:
void write_5(int *const &i)
{
*i = 5;
}
int main()
{
int m[2];
int *p = m;
write_5(p);
++p;
}
The reason for iterators being treated not the same way as pointers is probably
very "technical" as it is often in C++.
Anyway, whatever the reason I apologize I didn't doublecheck this.
Thank you.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140414/00db8664/attachment.html>
More information about the llvm-bugs
mailing list