forked from jzplp/Cpp-Primer-Answer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
32 lines (30 loc) · 759 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
#include <iostream>
#include <memory>
#include "Blob.h"
int main()
{
Blob<int> b({1,2,3});
b.push_back(4);
b.push_back(5);
b.pop_back();
for(BlobPtr<int> p = b.begin(); p != b.end(); ++p)
{
std::cout << *p << " ";
}
std::cout << std::endl;
std::cout << b.empty() << " " << b.size() << " " << b.back() << " " << b.front() << " " << b[2] << std::endl;
b = b;
Blob<int> b2 = b;
std::cout << (b == b2) << " " << (b.begin() > b.end()) << std::endl;
b = std::move(b);
for(ConstBlobPtr<int> p = b.cbegin(); p != b.cend(); ++p)
{
std::cout << *p << " " ;
}
std::cout << std::endl;
ConstBlobPtr<int> p = b.cbegin();
p++; --p;
std::cout << *p << " " << *(p+1) << " " << (p < (p+1)) << " " << (p - p+2);
std::cout << std::endl;
return 0;
}