/*
 * Copyright (c) 1999 Johnny C. Lam.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  The author makes no representations
 * about the suitability of this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 */

template <typename T>
void
auto_vector<T>::grow(size_type req_capacity)
{
    size_type new_capacity = 2 * capacity;
    if (req_capacity > new_capacity)
	new_capacity = req_capacity;
    auto_ptr<T>* new_array = new auto_ptr<T>[new_capacity];
    for (size_type i = 0; i < array_end; ++i)
	new_array[i] = array[i];
    delete [] array;
    array = new_array;
    capacity = new_capacity;
}
