[vtk-developers] Visual Studio 8 heads up regarding &*x.end()

Brad King brad.king at kitware.com
Fri Mar 3 09:30:32 EST 2006


Andrew Maclean wrote:
> I have encountered a problem with Visual Studio 8 in relation to the 
> issue of dereferencing an iterator.
[snip]
> My personal view is that I don't like things like that exemplified by " 
> char* end = &*this->Internal->Data.end();" because there is an implicit 
> assumption here that the notion of half-open intervals in the STL is 
> being circumvented by this approach.
> 
> I apologize if this sounds autocratic, but I am trying to save us all 
> lot of grief in the future! I suspect other compilers will follow suit.

This is definately not autocratic.  The code is just plain wrong and 
should be fixed whenever it is seen.  The C++ standard clearly states 
that dereferencing and end() iterator is not allowed.

-Brad



More information about the vtk-developers mailing list