• 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: Protecting memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Protecting memory


  • Subject: Re: Protecting memory
  • From: Charlie Dickman <email@hidden>
  • Date: Thu, 19 Jul 2012 10:10:56 -0400

Rich,

Thanks. This paradigm will do exactly what I need.

On Jul 18, 2012, at 10:08 PM, Rich Siegel wrote:

> On Wednesday, July 18, 2012, Charlie Dickman <email@hidden>
> wrote:
>
>> After initializing a necessarily mutable array is there any
>> straightforward way to protect it from being modified?
>
> Is it a code pattern in which you make a mutable array, populate it, and then want it to be immutable thereafter? If so, you could do something like:
>
>    NSMutableArray  *myArray = [NSMutableArray arrayWithCapacity: 0];
>    NSArray         *myConstArray = nil;
>
>    //...fill the array...
>
>    myConstArray = [NSArray arrayWithArray: myMutableArray];
>
> The result of [NSArray arrayWithArray] is an immutable NSArray, which it sounds like is what you want.
>
> R.
> --
> Rich Siegel                                 Bare Bones Software, Inc.
> <email@hidden>                      <http://www.barebones.com/>
>
> Someday I'll look back on all this and laugh... until they sedate me.
>

Charlie Dickman
email@hidden




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Protecting memory (From: Rich Siegel <email@hidden>)

  • Prev by Date: Re: Cannot produce executable target for command line tool in xcode 4.3
  • Next by Date: The speed of popover displays within Xcode
  • Previous by thread: Re: Protecting memory
  • Next by thread: Re: Protecting memory
  • Index(es):
    • Date
    • Thread