Hi Johannes,

On 1/03/11 20:29 , Johannes Baeuerle wrote:
> I agree to the thought of completely avoiding manual memory management. Is the
> following portable over different stl implementations?
> 
> std::vector<GLint> formats;
> formats.reserve(numFormats); 
> glGetIntegerv(GL_SHADER_BINARY_FORMATS, &formats[0]);
> 
> The problem is that the elements have to use consecutive memory as the method 
> requires
> a pointer to a GLint array. I found hints that many stl implementations write 
> elements
> of vectors into a consecutive area of memory. But I'm not quite sure.

std::vector is guaranteed to be in contiguous storage.  As such it's identical 
to memory
obtained with malloc/new.

Cheers,
/ulrich
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to