Re: Array of NSRange
Re: Array of NSRange
On Wed, Jul 10, 2002 at 10:34:50AM +0200, Nicola Vitacolonna wrote:
>
Just a silly question, about which I would like to know your opinion.
>
I need a data structure with an array of NSRange. What is the best way
>
to implement it in Cocoa? In Java there is a NSRange class, but in
>
Objective-C there are only types and functions. So, to use an NSArray I
>
should wrap my own custom class around the NSRange type. Another
>
possibility is to use plain C arrays, but I would miss all the
>
facilities of NSArrays...
>
Why doesn't Cocoa have an NSRange class? I suppose it is for efficiency,
>
but then, how could I efficiently implement an array of NSRange? Is
>
plain C the only solution?
You could, or use some C++ array class such as a STL vector. Or if
you don't care too much about storage space, use a NSValue.
+ (NSValue *)valueWithRange:(NSRange)range;
- (NSRange)rangeValue;
(in NSRange.h)
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.