By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,123 Members | 1,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,123 IT Pros & Developers. It's quick & easy.

Is there a simple (and quick) serialisation method for simple vectors?

P: n/a
I want to serialise quickly a "simple" vector :
(simple is to say with basic types and no pointers)
such as :

class c
{
int i,j;
double z;
}

vector<c> cs;

Is there some simple efficient way such as :
memcpy(mybuff, cs , sizeof(what?))...

I am using SGI stl.

Thank you in advance
Pierre Couderc
Jul 29 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Pierre Couderc wrote:
I want to serialise quickly a "simple" vector :
(simple is to say with basic types and no pointers)
such as :

class c
{
int i,j;
double z;
} ;
vector<c> cs;
Supposedly you included the proper headers...
Is there some simple efficient way such as :
memcpy(mybuff, cs , sizeof(what?))...

I am using SGI stl.


What's "mybuff"?

You should probably do

memcpy(mybuff, &cs[0], cs.size() * sizeof(c));

V
Jul 29 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.