- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
static struct bodytype {
double pos[3];
double vel[3];
double acc[3];
double mass;
int ThreadID;
} body
concurrent_vector
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
double pos[3];
double vel[3];
double acc[3];
double mass;
int ThreadID;
};
concurrent_vector
cvbody.shrink_to_fit(); // this might be needed, I cant see the code for the internal_resize, but maybe someone else can comment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"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.
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page