Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Bartłomiej Błazik
- #pragma once
- #include "Vector.h"
- #include <string>
- #include <iostream>
- using namespace std;
- //PrintVector
- template <typename T>
- void printVector(const Vector<T>& v, std::string id)
- {
- if (v.empty())
- cout << "Vector " << id << " jest pusty.\n\n";
- else
- {
- cout << id << ": { ";
- for (typename Vector<T>::size_type i = 0; i < v.size(); i++)
- {
- cout << v[i] << "; ";
- }
- cout << "Capacity: " << v.capacity();
- cout << "}\n\n";
- }
- }
- //PrintVector - koniec
- int main()
- {
- Vector<int,std::allocator<int>> v1;
- Vector<int, std::allocator<int>> v2(5);
- printVector(v1, "v1");
- printVector(v2, "v2");
- /*
- v1[1] = 1;
- v1.reserve(6);
- printVector(v1, "v1 after reserve 6");
- v2.resize(6);
- printVector(v2, "v2 after resize 6");
- //v2.push_back(3);
- //printVector(v2, "v2 after pushback");
- */
- cout <<
- system("pause");
- }
- #include "Vector.cpp"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement