Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is there a simple (and quick) serialisation method for simple vectors?

Reply
Thread Tools

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

 
 
Pierre Couderc
Guest
Posts: n/a
 
      07-29-2005
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


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      07-29-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Good cross-version ASCII serialisation protocol for simple types Paul Moore Python 4 02-23-2013 07:00 PM
XML Serialisation problem - sending a business object over a webservice Nick Gilbert ASP .Net 4 05-25-2005 03:32 PM
What is vanilla serialisation called? VisionSet Java 1 07-03-2004 06:08 PM
Axis client side data serialisation question. Michael Binz Java 0 10-29-2003 07:22 PM
Serialisation inefficiency Roedy Green Java 8 09-18-2003 07:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57