• 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: Casting from NSArray to a custom class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Casting from NSArray to a custom class


  • Subject: Re: Casting from NSArray to a custom class
  • From: Justin Spahr-Summers <email@hidden>
  • Date: Wed, 16 Feb 2005 08:17:08 -0600

On Wed, 16 Feb 2005 01:37:06 -0800 (PST), newdev@yahoo
<email@hidden> wrote:
> Hi all,
>
>
>           As for details of what I want to do -
> I have got an NSArray* that should contain some data; a list(array) of
> struct mystruct
> {
>  unsigned long varA;
>  unsigned long varB;
> }
> objects.

Well first of all, NSArrays cannot contain standard types, they can
only contain Objective-C objects, so assuming your NSArray holds
NSNumbers, you would have to access each NSArray object in a loop and
get that NSNumber, and then your unsigned long from that.

>
> I apologize for miscommunication if any, but I thought that it was imminent
> that I was talking about 'reference' to an object. I think my reference to
> 'reinterpret_cast' should have made the things clear.

All Objective-C "objects" are really just pointers. This does not
mean, however, that you can cast the pointer to a struct. You must get
the objects contained in the array.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Casting from NSArray to a custom class
      • From: "newdev@yahoo" <email@hidden>
References: 
 >Re: Casting from NSArray to a custom class (From: "newdev@yahoo" <email@hidden>)

  • Prev by Date: Re: Sorting
  • Next by Date: RE: Re: Sorting
  • Previous by thread: Re: Casting from NSArray to a custom class
  • Next by thread: Re: Casting from NSArray to a custom class
  • Index(es):
    • Date
    • Thread