Quick Q: Is vector storage contiguous? -- Stack Overflow

Quick A: Yes.

Recently on SO:

std::vector: contiguous data and copy/move

I have two questions for the following code: 1) Will the elements of faces be contiguous? 2) Does std::vector copy or move Face f when inserting it?

#include <vector>   
int main()
{
    struct Face {};
    std::vector<Face> faces;

    for (int i=0; i<10; ++i)
    {
        Face f;

        faces.push_back (f);
    }

    return 0;
}

 

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.