• 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: Storing C objects (structs) in NS Containers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing C objects (structs) in NS Containers?


  • Subject: Re: Storing C objects (structs) in NS Containers?
  • From: j o a r <email@hidden>
  • Date: Mon, 12 Jul 2004 20:35:42 +0200

Wrap the item in a NSValue instance, and then stick the NSValue
instance in the Cocoa container.

Of course, wrapping items in Cocoa objects like this adds a bit of
overhead, both for processing and for memory requirements, so it's
probably best suited for when you don't have that many items, and when
you don't need crazy performance.

The next step below Cocoa is of course CoreFoundation where you have
better abilities to work with plain C data types, but still have an
almost-Obj-C interface to the API.

j o a r

On 2004-07-12, at 20.17, Cody Garvin wrote:

> Is it possible to store C Structs in a NSContainer...
>
> For example, I want to store NSRect into a NSMutableArray.
> Do I have to use a normal C Array to do this? I know that when you add
> an
> object to NSMutableArray it sends a retain message to the object that
> is
> being added, but is there a way to force it any way?

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >Storing C objects (structs) in NS Containers? (From: "Cody Garvin" <email@hidden>)

  • Prev by Date: Re: Storing C objects (structs) in NS Containers?
  • Next by Date: Re: Storing C objects (structs) in NS Containers?
  • Previous by thread: Re: Storing C objects (structs) in NS Containers?
  • Next by thread: Re: Storing C objects (structs) in NS Containers?
  • Index(es):
    • Date
    • Thread