• 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: Porting 'operator' to Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Porting 'operator' to Obj-C


  • Subject: Re: Porting 'operator' to Obj-C
  • From: Robert Claeson <email@hidden>
  • Date: Fri, 26 Sep 2008 17:13:11 +0200


On 26 Sep 2008, at 17:03, Alex Finkel wrote:

Hi there.
I am in a process of porting some C++ code to ObjC. How to port the code
bellow (operators). Thanks.

---- snip -----

operator= is a normal assignment method that takes an NSArray as its argument. Something like the following (untested) code, depending on what the rest of the C++ class looks like:

- (void)setEncodings:(NSArray *)encoding {
	_count = [encoding size];
	_encodings = [encoding copy];
}

But I wouldn't even have the _count instance variable. It's just as easy to just ask the _encodings array for its size whenever needed.

The other methods are left as an exercise to the reader.

I originally learned C++ back in the 80's from a guy named Bjarne Stroustrup, but I'd pick Objective C any time.

Robert

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Porting 'operator' to Obj-C
      • From: "Alex Finkel" <email@hidden>
References: 
 >Porting 'operator' to Obj-C (From: "Alex Finkel" <email@hidden>)

  • Prev by Date: Re: Fastest color detection in image?
  • Next by Date: Re: objc_msgSend_ptr
  • Previous by thread: Re: Porting 'operator' to Obj-C
  • Next by thread: Re: Porting 'operator' to Obj-C
  • Index(es):
    • Date
    • Thread