• 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: Cocoa equivalent of std::vector<MyType> ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa equivalent of std::vector<MyType> ?


  • Subject: Re: Cocoa equivalent of std::vector<MyType> ?
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 14 Dec 2008 15:01:45 +0100


Le 14 déc. 08 à 14:42, Guillaume Laurent a écrit :


On Dec 14, 2008, at 13:45 , Jean-Daniel Dupas wrote:


Le 14 déc. 08 à 13:34, Guillaume Laurent a écrit :

Hi all,

I need to create an array of values of a specific type, and I'd prefer to have it as a set of values rather than pointer to values (mostly performance reasons), so not an NSMutableArray. I couldn't find anything in Cocoa to do this, am I missing something or is it just not a "Cocoa-ish" way of doing things ? :-)

Thx,

--


You can use a CFArrayRef.

CFMutableArrayRef myArray = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);

Yes, a friend of mine pointed me to that solution, but as far as I can see, it's still an array of pointers, not an array of values (and its API is fugly if you ask me :-) )

An Array of pointer or any value that have a size smaller or equal to pointer size (fit perfectly to store an array of integer).
If your value is bigger than a pointer, you will have to use the Obj-C+ + way.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cocoa equivalent of std::vector<MyType> ? (From: Guillaume Laurent <email@hidden>)
 >Re: Cocoa equivalent of std::vector<MyType> ? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Cocoa equivalent of std::vector<MyType> ? (From: Guillaume Laurent <email@hidden>)

  • Prev by Date: Re: Cocoa equivalent of std::vector<MyType> ?
  • Next by Date: Notification Sent When Window Is Ordered Back?
  • Previous by thread: Re: Cocoa equivalent of std::vector<MyType> ?
  • Next by thread: Re: Cocoa equivalent of std::vector<MyType> ?
  • Index(es):
    • Date
    • Thread