FROM : Thomas Engelmeier
DATE : Sat Mar 22 19:46:36 2008
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
DATE : Sat Mar 22 19:46:36 2008
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 mail archive

