|
-
June 19th, 2002, 03:09 PM
#1
Getting an array from a std::vector's contents
I'm writing a program now in which I need to keep an array of HANDLE objects, to pass to a Win32 API function that I'm using. The HANDLE's refer to threads that I'm creating in a for loop. Having paid much attention to the comments of posters here, I'm placing each one into a std::vector container as I create it. Is there any good way to get the contents of a vector as an array?
If I remember my introductory C++ class correctly, we talked about <vector>, and I think it held the data internally in an array of increasing size as was needed. If this is correct, could I use vector::front() to get the first element, and vector::size() to get the size of the "array?" It sounds like it will work for me, but I'm not sure that this is good practice. Is this a case where I should just dynamically allocate an array instead of using std::vector? Thanks for any input on this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|