forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
35 lines (27 loc) · 746 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/***************************************************************************
* @file main.cpp
* @author Alan.W
* @date 02 Feb 2014
* @remark This code is for the exercises from C++ Primer 5th Edition
* @note
***************************************************************************/
//
// Exercise 16.16:
// Rewrite the StrVec class (§ 13.5, p. 526) as a template named Vec.
//
#include "vec.h"
#include <vector>
#include <iostream>
int main()
{
Vec<int> v = { 1, 2, 3, 4, 5 };
Vec<int> v2;
v2 = v;
std::cout << v2.capacity() << "\n";
v2.push_back(99);
v2.resize(2, 2);
for (auto t : v2)
std::cout << t << " ";
std::cout << v2.capacity() << "\n";
return 0;
}