-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (37 loc) · 1.26 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (37 loc) · 1.26 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "Array.h"
#include <iostream>
#include <numeric>
template<typename T>
void PrintStats(Array<T> array)
{
for (size_t i = 0; i < array.Size(); i++) std::cout << array[i] << std::endl;
std::cout << "Size: " << array.Size() << "\nCapacity: " << array.Capacity() << std::endl << std::endl;
}
int main()
{
Array<int> test(10, 1);
Array<int> numbers{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
numbers.Insert(numbers.begin() + 5, 50);
for (auto value : numbers) std::cout << value << "\n";
std::cout << '\n';
numbers.RemoveOrdered(numbers.begin() + 5);
for (auto value : numbers) std::cout << value << "\n";
numbers.RemoveUnordered(numbers.begin() + 5);
for (auto value : numbers) std::cout << value << "\n";
//auto sum = std::accumulate(numbers.begin(), numbers.end(), 0);
//std::cout << sum << std::endl;
//auto thing = numbers.Find(3);
//if (thing != numbers.end()) std::cout << *thing << " has been found.\n";
//else std::cout << "Not found.\n";
//PrintStats(numbers);
//numbers.PushBack(1);
//PrintStats(numbers);
//numbers.PopBack();
//PrintStats(numbers);
//numbers.Deallocate(20);
//PrintStats(numbers);
//numbers.Allocate(20);
//PrintStats(numbers);
//numbers.PushBack(3);
//PrintStats(numbers);
}