> :: end ()
{n;
} _t Vector :: capacity ()
{capacity_m;
} Vector :: swap (Vector & Vect)
{:: swap (V, Vect.V); :: swap (n, Vect.n); :: swap (capacity_m, Vect.capacity_m);
} :: Vector (const Vector & Vect)
{= Vect.n; _m = Vect.capacity_m; = new T [n]; (size_t i = 0; i
(* this) [i] = Vect.V [i];
} & Vector :: operator [] (size_t i)
{(i
} :: Vector (size_t new_size)
{= new_size; _m = new_size; = new T [new_size]; (size_t i = 0; i
(* this) [i] = T ();
} & Vector :: erase (size_t k)
{(k> = n) throw out_of_range ("vector index"); buf = * this; -; (size_t i = 0; i
{
(* this) [i] = buf [i +1]; + +;
} * this;
} Vector :: push_back (T new_item)
{(size () == capacity ()) reserve (capacity () * 2);
(* this) [n + +] = new_item;
} Vector :: resize (size_t new_size)
{(new_size <= size ())
{= new_size;;
} (new_size> capacity ()) (new_size * 2); [] V; = new T [new_size]; (n! = new_size)
(* this) [n + +] = T ();
} Vector :: reserve (size_t new_cap)
{(new_cap <= capacity ()) return; buf;. V = new T [new_cap];. capacity_m = new_cap;. n = n;
(size_t i = 0; i
}
Результати роботи програми
В
В В
В