• 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: deep deep copies, or shallow deep copies?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deep deep copies, or shallow deep copies?


  • Subject: Re: deep deep copies, or shallow deep copies?
  • From: Kiel Gillard <email@hidden>
  • Date: Fri, 14 Nov 2008 11:18:29 +1100

Hi Graham,

If you do want a deep copy of a collection, check out <http://developer.apple.com/documentation/CoreFoundation/Reference/CFPropertyListRef/Reference/reference.html#//apple_ref/c/func/CFPropertyListCreateDeepCopy >. NSPropertyListSerialization would be the Cocoa equivalent of this API.

Kiel

On 14/11/2008, at 11:07 AM, Ken Ferry wrote:

On Thu, Nov 13, 2008 at 3:58 PM, Graham Cox <email@hidden> wrote:
Does anyone know whether methods such as:

[NSArray initWithArray:<someArray> copyItems:YES];

continue to deep-copy items for further collections within the root
collection, or do they fall back to a shallow copy (retaining)?

If no-one knows I can spend an hour or two doing some experiments but if
it's just a known 'yes' or 'no' I'd rather save the time!

It will send the -copy method to each of the items in the array, and insert the resulting copies into the new array.

So, context specific.  If the items are Cocoa collections, that means
shallow copies of items.

-Ken
_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: deep deep copies, or shallow deep copies?
      • From: Graham Cox <email@hidden>
References: 
 >deep deep copies, or shallow deep copies? (From: Graham Cox <email@hidden>)
 >Re: deep deep copies, or shallow deep copies? (From: "Ken Ferry" <email@hidden>)

  • Prev by Date: Re: Weird bug in IB...
  • Next by Date: Re: deep deep copies, or shallow deep copies?
  • Previous by thread: Re: deep deep copies, or shallow deep copies?
  • Next by thread: Re: deep deep copies, or shallow deep copies?
  • Index(es):
    • Date
    • Thread