Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > STL vs. Core Foundation

STL vs. Core Foundation
Thread Tools
Junior Member
Join Date: Apr 2000
Location: San Francisco, CA
Status: Offline
Reply With Quote
Nov 28, 2001, 12:00 AM
 
This may be obvious, but are there any advantages at all of using Apple's Core Foundation libraries like CFArray and CFDictionary over the STL templates lime map<> and vector<> (if you are programming in C++ that is)? I've used STL so much, and I see the Core Foundation container libraries are STL -like, but is there any real advantage (like extra-efficient use of kernel?)?

Michael Kamprath
--
Michael F. Kamprath
     
Fresh-Faced Recruit
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 28, 2001, 11:17 AM
 
Originally posted by kamprath:
<STRONG>This may be obvious, but are there any advantages at all of using Apple's Core Foundation libraries like CFArray and CFDictionary over the STL templates lime map&lt;&gt; and vector&lt;&gt; (if you are programming in C++ that is)? I've used STL so much, and I see the Core Foundation container libraries are STL -like, but is there any real advantage (like extra-efficient use of kernel?)?

Michael Kamprath</STRONG>
If you want portable code, shouldn't you stick with STL?
     
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Nov 28, 2001, 12:14 PM
 
One advantage of CoreFoundation over the STL is that CoreFoundation has a built in memory management paradigm: the retain/release reference counting. As far as I know, the STL has none.

Another advantage is that there's a lot more to CoreFoundation than there is to the STL. For example, CF has objects for sockets, preferences, run loops, and a lot more that's not part of STL. Those objects require and return CF collections and CF strings rather than the STL equivalents, so if you're planning on using those CF objects as well as the STL, you'll be converting between collections quite a bit.

-Peter
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Boulder, CO, USA
Status: Offline
Reply With Quote
Nov 28, 2001, 05:36 PM
 
I'm not in the know, having not looked at it all first-hand, but MacApp supposedly has some utility classes which wrap CF containers with C++ interfaces. Might be worth looking into. They also said (at the last WWDC) that they were moving towards a more STL-like paradigm across the board for their containers and such.

This was all before Apple announced they would stop updating MacApp, of course.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:17 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2