Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best Way To Lookup From a Huge Table




On 21.03.2008, at 21:51, John Stiles wrote:

std::map actually does more than NSDictionary—it sorts its entries instead of keeping them in random order. Also, it copies its keys instead of just keeping a reference to them, which is also more work— it would be a much fairer test if you used std::string* pointers for your keys and values instead of std::string objects, but it'd also be a little more work since you'd need a custom comparator and you'd need to consider memory management (which boost smart pointers apparently can manage pretty well).

No need to pull in the whole boost overhead for smart(er) pointers as of gcc 4.0.


#include <tr1/memory>
using std::tr1::shared_ptr;

And for the presorting time - TR1 includes also an unordered_map and unordered_set.

Regards,
	Tom_E

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Best Way To Lookup From a Huge Table (From: Scott Ribe <email@hidden>)
 >Re: Best Way To Lookup From a Huge Table (From: "E. Wing" <email@hidden>)
 >Re: Best Way To Lookup From a Huge Table (From: "Michael Ash" <email@hidden>)
 >Re: Best Way To Lookup From a Huge Table (From: John Stiles <email@hidden>)
 >Re: Best Way To Lookup From a Huge Table (From: "Michael Ash" <email@hidden>)
 >Re: Best Way To Lookup From a Huge Table (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.