Skip navigation.
 
mlRe: float[4][3] into NSValue
FROM : Paul Sargent
DATE : Tue Nov 20 20:59:50 2007

On 20 Nov 2007, at 19:57, Allen Smith wrote:

>
> On Nov 20, 2007, at 11:37 AM, Paul Sargent wrote:
>

>>
>> On 20 Nov 2007, at 19:16, Lorenzo wrote:
>>

>>> Can I store a float[4][3] into an NSValue object?
>>> Or can I store my own struct in an NSValue?
>>> If yes, how to do that?
>>> And how to get back the float[4][3] from the NSValue?

>>
>> No, NSValues are for single values, not arrays of them.

>
> Why do you say that? NSValue can store arbitrary structures, as long 
> as they are of fixed length.
>
> float test[4][3]    = {{1.0, 2.0, 3.0}};
> float result[4][3]    = {0.0};
>
> NSValue *value = [NSValue value:test withObjCType:@encode(float[4]
> [3])];
>
> [value getValue:result];
>
> NSLog(@"%f %f %f", result[0][0], result[0][1], result[0][3]);
>
>
> >>
> 2007-11-20 11:54:03.553 test[18824] 1.000000 2.000000 0.000000


Ok, I didn't know that.

Consider me slapped.

Related mailsAuthorDate
mlfloat[4][3] into NSValue Lorenzo Nov 20, 20:16
mlRe: float[4][3] into NSValue Hank Heijink Nov 20, 20:37
mlRe: float[4][3] into NSValue Paul Sargent Nov 20, 20:37
mlRe: float[4][3] into NSValue Allen Smith Nov 20, 20:57
mlRe: float[4][3] into NSValue Paul Sargent Nov 20, 20:59
mlRe: float[4][3] into NSValue Lorenzo Nov 20, 21:14
mlRe: float[4][3] into NSValue Nick Zitzmann Nov 20, 21:32
mlRe: float[4][3] into NSValue David Spooner Nov 20, 21:50
mlRe: float[4][3] into NSValue Ricky Sharp Nov 20, 22:42
mlRe: float[4][3] into NSValue David Spooner Nov 21, 01:04