Re: Casting from NSArray to a custom class
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