Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Joseph_S_Intel
Employee
53 Views

creating a concurrent_vector

I'd like to create a concurrent_vector that is initialized with a set number of structures (100), however I am not sure of the syntax to use. Is the code below correct? If not what is the correct code?

static struct bodytype {
double pos[3];
double vel[3];
double acc[3];
double mass;
int ThreadID;
} body

concurrent_vector cvbody(100);
0 Kudos
2 Replies
smasherprog
Beginner
53 Views

struct bodytype {
double pos[3];
double vel[3];
double acc[3];
double mass;
int ThreadID;
};

concurrent_vector cvbody(100);
cvbody.shrink_to_fit(); // this might be needed, I cant see the code for the internal_resize, but maybe someone else can comment.
RafSchietekat
Black Belt
53 Views

"cvbody.shrink_to_fit(); // this might be needed, I cant see the code for the internal_resize, but maybe someone else can comment."
shrink_to_fit() is only relevant after several separate additions might have fragmented the concurrent_vector, or to remove underlying storage altogether after clear(), so it has no purpose right after initialisation.
Reply