> Do the STL stacks, vectors, and other collections automatically copy
> the memory referenced by a pointer? This would surprise me.
std::vector< FSRef > fsrvec;
*not*
std::vector< FSRef * > fsrvec;
Then, yes, the contents of the FSRef do automatically get copied in. And you
wouldn't even need to depend on that all the time, since you can just use:
&fsrvec[i]
When you need an FSRef *. This applies equally to functions that get FSRef
as to ones that take FSRef, and a function that expects a C array of FSRefs
to fill in can be passed &fsrvec[0].
> This code (internally) still has to allocate some new memory, use copy
> the stuff at the FSRef * to it.
>
> So, I'm well aware of the convenience of the STL, but I have no reason
> to believe it's faster than CF.
You're obviously not aware of the efficiency of the STL, which is what I was
hinting at in my last post. There's rarely any possibility of being more
efficient than appropriate STL containers properly used--that's one of the
major points of the STL.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 665-7007 voice
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden