-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.cpp
42 lines (34 loc) · 887 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
36
37
38
39
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include "HasPtr.h"
int main()
{
std::vector<HasPtr> hs{HasPtr("a789a"), HasPtr("a456a"), HasPtr("a123a"), HasPtr("a103a"), HasPtr("a699a"), HasPtr("a299a"), HasPtr("a999a"), HasPtr("a991a")};
std::string s("a123a");
for(int i = 0; i < 10; ++i)
{
s[1] = '0' + i;
hs.push_back(s);
}
std::sort(hs.begin(), hs.end());
for(const HasPtr &ihs : hs)
ihs.print(std::cout) << std::endl;
HasPtr a("12345"), c("67890");
a.print(std::cout) << std::endl;
HasPtr b = a;
b.print(std::cout) << std::endl;
b = c;
b.print(std::cout) << std::endl;
swap(a,c);
a.print(std::cout) << std::endl;
c.print(std::cout) << std::endl;
std::cout << std::endl;
HasPtr a5 = std::move(a);
a5.print(std::cout) << std::endl;
b = std::move(a5);
b.print(std::cout) << std::endl;
return 0;
}