• 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: Array of NSRange
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array of NSRange


  • Subject: Re: Array of NSRange
  • From: Nicholas Riley <email@hidden>
  • Date: Wed, 10 Jul 2002 03:50:20 -0500
  • Mail-followup-to: Nicola Vitacolonna <email@hidden>, email@hidden

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.

References: 
 >Array of NSRange (From: Nicola Vitacolonna <email@hidden>)

  • Prev by Date: Array of NSRange
  • Next by Date: Re: Database Suggestions
  • Previous by thread: Array of NSRange
  • Next by thread: Re: Array of NSRange
  • Index(es):
    • Date
    • Thread