Skip to main content
gamedev.net
🔒 Locked

STL array?

Started by john_t Mar 27, 2006 at 1:25 PM 3 replies 600+ views
Original Post
john_t
john_t
I can't seem to find an STL container that will supply me with a pointer to an array of its contents. I would think that the obvious candidate would be vector, but it doesn't expose this functionality. It seems that such function should exist--for instance, string will supply a char* to its data with string::c_str(). Am I missing something obvious?
Xai
Xai
I would have to read the spec a lot closer, but I believe vector.begin() can be used this way ... although I'm not sure how strict this is ... I know the rule says a vector must contain a contiguous block of memory for its items (ignore vector for the love of god) ...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.