Lior Silberman <[EMAIL PROTECTED]> writes:

| I know this _feels_ bad, but I think the most efficient implementation
| will be to handle the temporary ourselves:
| 
| Menu* Menu::expand (Buffer* buf)
|       {
|       Menu *resulting_menu = new Menu();
|       ...
|       // add stuff to the new menu
|       ...
|       return resulting_menu;
|       }
| 
| Which can be used as:
| 
| Menu *tmp = menu.expand();
| ...
| ...
| delete tmp;

It breaks the "I allocate, I deallocate" idom.

I'd rather see a Menu & passed in that case.
That is the clean way of avoiding a copy.

If you already have the object somewhere reaturn a reference.

        Lgb



Reply via email to