• 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: Dan Crevier <email@hidden>
  • Date: Wed, 06 Nov 2002 21:50:16 -0800

On 11/6/02 5:14 AM, "Clark S. Cox III" <email@hidden> wrote:

> 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()];

I think you want &myVector[0] instead of &myVector.front(). Using front()
assumes that the iterators for vectors are simple pointers.

Dan
_______________________________________________
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: "Clark S. Cox III" <email@hidden>
References: 
 >Re: How to encode STL vector (From: "Clark S. Cox III" <email@hidden>)

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