• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to encode STL vector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to encode STL vector


  • Subject: Re: How to encode STL vector
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Wed, 6 Nov 2002 08:14:04 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Wednesday, Nov 6, 2002, at 04:46 US/Eastern, Arthur Clemens wrote:

I was wondering how to encode a vector type using NSCoding?
I have a vector of unsigned ints.

You can encode it just like you would a plain C array:

//Encode
const unsigned size = myVector.size();
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &size];
[aCoder encodeArrayOfObjCType: @encode(unsigned) count: size at: &myVector.front()];


//Decode
unsigned size;
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &size];
myVector.resize(size);
[aCoder decodeArrayOfObjCType: @encode(unsigned) count: size at: &myVector.front()];




- -- http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iEYEARECAAYFAj3JFaEACgkQd6STocYT1xU0DgCgivde3YABrvCI0libIgux2go2
XbYAn2nUgN2QRSxGtnv4ayeiVvnYJ0S+
=SsE4
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: How to encode STL vector
      • From: Dan Crevier <email@hidden>
    • Re: How to encode STL vector
      • From: Arthur Clemens <email@hidden>
References: 
 >How to encode STL vector (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Re: Move a file to the Trash
  • Next by Date: Re: Move a file to the Trash
  • Previous by thread: How to encode STL vector
  • Next by thread: Re: How to encode STL vector
  • Index(es):
    • Date
    • Thread