Re: Initialize NSArray with C array?
Re: Initialize NSArray with C array?
- Subject: Re: Initialize NSArray with C array?
- From: Allan Odgaard <email@hidden>
- Date: Thu, 23 Sep 2004 07:12:44 +0200
On 23. Sep 2004, at 3:30, Scott Stevenson wrote:
Is there a simple efficient way to initialize a NSArray with a C
array of doubles (converting them to NSNumbers in the process)? [...]
Oh... I completely missed the chance of mentioning CocoaSTL...
double src[] = { ... };
NSMutableArray* dst = ...;
std::transform(beginof(src), endof(src), back_inserter(dst),
unary_method<double>("numberWithDouble:")([NSNumber class]));
While "simple" here can be questioned, but it's short and avoids the
loop ;)
--
http://macromates.com/ ::: TextMate, OS X text editor
http://macromates.com/sigpipe/ ::: Personal weblog about
programming
_______________________________________________
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