[comp.lang.c++] another error in vector.h 1.3

weijers@cwi.nl (Eric Weijers) (12/10/87)

In "vector.h 1.3" the following definition of the X(X&) constructor
is given:

vector(type).vector(type)(vector(type)& a)
{
	register i = a.sz;
	sz = a.sz; 			/* ADD THIS LINE */
	v = new type[i];
	register type* vv = &v[i];
	register type* av = &a.v[i];
	while (i--) *--vv = *--av;
}

You should add the indicated line in order to set the size of
the new vector. If that is not done you get "vector index out of
range" errors.

I found two other errors in this header file, I posted
earlier. If you are interested in them just send a reply (r).

Eric Weijers.
weijers@cwi.nl