On 2005-11-18 06:56, Neelesh Bodas wrote:
Digital Puer wrote: Hi, in Java I know that you can convert a vector into an array of
Object with toArray(). Is there a corresponding function in STL
that will immediately convert a vector of T into an array of T?
// v is the name of the vector, arr is the name of the array
std::copy(v.begin(), v.end(), arr);
Or (a bit more ugly) as mentioned on another thread you can take the
address of the first object and use it as a array (since a vector will
store the elements contiguously).
Erik Wikström
--
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone" -- Bjarne Stroustrup