> If it's a large object that has long c-tor time the best method is to
> return a const refernce as in: Menu const & expand(Buffer *) const;
You are not suggesting to return a reference to a local variable, are you?
If so, this is the most wicked suggestion ever made - including those made
on a Friday ;-}
Once the function is left, there is no guarantee that the stack space
used by it contains any sensible data. Hell, there is not even a guarantee
your locals have been on "the stack", they could have been anywhere and
are overwritten in the meantime by a concurrent process/thread/whatever.
The fact that it "usually just works" is pure luck. I'd even say "bad luck".
If you need the object you got to bite into the sour apple and copy it.
Andre'
PS: And as I noticed in another post: Copying is not bad _unless your
profiler has shown otherwise_.
--
Andre' Poenitz ........................................ [EMAIL PROTECTED]