James Kanze
12/4/2008 11:57:00 AM
On Dec 4, 7:27 am, Erik Wikström <Erik-wikst...@telia.com> wrote:
> On 2008-12-04 06:14, Rolf Magnus wrote:
> > Pascal J. Bourguignon wrote:
> >>> what is the impact of argument in recursive function. I am
> >>> passing vector as my argument.
> >> If you're passing a vector, it will have to be copied
> >> probably on the stack, so you will probably use a lot of
> >> stack space for each recursive call.
> > Typical vector implementations are rather small (in the
> > extreme case one pointer and two integers).
> The real impact comes from copying all the elements in the
> vector, unless something like copy on write is used.
An implementation of std::vector can't use copy on write, since
this would require violating some of the constraints on the
validity of pointers and references into the container.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34