Mike Weiblen wrote:
> std::vector is guaranteed to have contiguous memory.  So vector.front() or
> &(vector[0]) are legal references to the first element of a c-style array.
>  That is why it is important to preallocate vectors to the expected length
> when possible, to avoid the reallocation hit necessary to preserve
> contiguous memory.  std::deque has similar accessors, but is not
> contiguous, so reallocation is much cheaper, but you cant use as a
> c-array.
>
> It's not a hack, it's documented and legal behavior.
>   

This behavior is not mandated by the standard, but there is a resolution 
proposing it be made so (for all types other than bool):

http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-defects.html#69


--"J"

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to