|
-
April 28th, 2014, 06:50 AM
#10
Re: passing an array as a pointer to a function
 Originally Posted by zizz
Both std::array and std::vector are defined to have a contiguous memory layout (as of the C++ 11 standard). This means they are guaranteed to be as efficient as old-style C arrays (you're currently using) when it comes to accesses.
This is slightly off.
it'll be as efficient as old-style ALLOCATED C style array.
by it's very nature, a C style array does not need allocation or deallocation, nor does it need (indirect) access through a pointer.
in that respect c-style array -> std::array<>
heap allocated c-style array -> std::vector<>
there are cases where local vs heap allocated might be an important decision factor.
Tags for this Thread
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
|