// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH13_CopyControl/examples/useStrVec.cc
// Function: main
int main()
{
	StrVec sv = {"one", "two", "three"};
	// run the string empty funciton on the first element in sv
	if (!sv[0].empty())
		sv[0] = "None"; // assign a new value to the first string

	// we'll call getVec a couple of times
	// and will read the same file each time
	ifstream in("data/storyDataFile");
	std::cout << "HenryDbg::tp1------------------->" << std::endl;
	StrVec svec = getVec(in);
	std::cout << "HenryDbg::tp1------------------->" << std::endl;
	print(svec);
	in.close();

	cout << "copy " << svec.size() << endl;
	std::cout << "HenryDbg::tp2------------------->" << std::endl;
	auto svec2 = svec;
	std::cout << "HenryDbg::tp2------------------->" << std::endl;
	print(svec2);

	cout << "assign" << endl;
	StrVec svec3;
	std::cout << "HenryDbg::tp3------------------->" << std::endl;
	svec3 = svec2;
	std::cout << "HenryDbg::tp3------------------->" << std::endl;
	print(svec3);

	StrVec v1, v2;
	std::cout << "HenryDbg::tp4------------------->" << std::endl;
	v1 = v2;                   // v2 is an lvalue; copy assignment
	std::cout << "HenryDbg::tp4------------------->" << std::endl;

	in.open("data/storyDataFile");
	std::cout << "HenryDbg::tp5------------------->" << std::endl;
	v2 = getVec(in);          // getVec(in) is an rvalue; move assignment
	std::cout << "HenryDbg::tp5------------------->" << std::endl;
	in.close();

	StrVec vec;  // empty StrVec
	string s = "some string or another";
	std::cout << "HenryDbg::tp6------------------->" << std::endl;
	vec.push_back(s);      // calls push_back(const string&)
	vec.push_back("done"); // calls push_back(string&&)
	std::cout << "HenryDbg::tp6------------------->" << std::endl;

	// emplace member covered in chpater 16
	s = "the end";
	std::cout << "HenryDbg::tp7------------------->" << std::endl;
	vec.emplace_back(10, 'c'); // adds cccccccccc as a new last element
	vec.emplace_back(s);  // uses the string copy constructor
	string s1 = "the beginning", s2 = s;
	vec.emplace_back(s1 + s2); // uses the move constructor
	std::cout << "HenryDbg::tp7------------------->" << std::endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
leaq 0xb9a(%rip), %rsi       # 0x300f
leaq -0x348(%rbp), %r14
leaq -0x70(%rbp), %rdx
movq %r14, %rdi
callq 0x2070
leaq -0x328(%rbp), %r15
leaq 0xb6e(%rip), %rsi       # 0x3004
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x2070
leaq -0x308(%rbp), %r15
leaq 0xb58(%rip), %rsi       # 0x3008
leaq -0xa8(%rbp), %rdx
movq %r15, %rdi
callq 0x2070
leaq -0x120(%rbp), %rdi
leaq -0x348(%rbp), %rsi
pushq $0x3
popq %rdx
callq 0x2b22
pushq $0x40
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0x348, %rdi           # imm = 0xFCB8
callq 0x2090
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x24d8
movq -0x120(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x250c
leaq 0xb07(%rip), %rsi       # 0x300e
callq 0x21c0
leaq 0xb00(%rip), %rsi       # 0x3013
leaq -0x348(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x21b0
movq 0x2aaf(%rip), %rdi      # 0x4fd8
leaq 0xaf6(%rip), %rsi       # 0x3026
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x88(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x23d9
movq 0x2a81(%rip), %rdi      # 0x4fd8
leaq 0xac8(%rip), %rsi       # 0x3026
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x88(%rbp), %rdi
callq 0x234c
leaq -0x348(%rbp), %rdi
callq 0x2030
movq 0x2a4e(%rip), %rdi      # 0x4fd8
leaq 0xab7(%rip), %rsi       # 0x3048
callq 0x2100
movq -0x80(%rbp), %rsi
subq -0x88(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x20a0
movq 0x2a1c(%rip), %rdi      # 0x4fd8
leaq 0xa8b(%rip), %rsi       # 0x304e
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xf0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x2b4a
movq 0x29ee(%rip), %rdi      # 0x4fd8
leaq 0xa5d(%rip), %rsi       # 0x304e
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xf0(%rbp), %rdi
callq 0x234c
movq 0x29c7(%rip), %rdi      # 0x4fd8
leaq 0xa58(%rip), %rsi       # 0x3070
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xd8(%rbp), %rdi
callq 0x2a9a
movq 0x29a0(%rip), %rdi      # 0x4fd8
leaq 0xa38(%rip), %rsi       # 0x3077
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xd8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2b92
movq 0x2972(%rip), %rdi      # 0x4fd8
leaq 0xa0a(%rip), %rsi       # 0x3077
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xd8(%rbp), %rdi
callq 0x234c
leaq -0x108(%rbp), %rdi
callq 0x2a9a
leaq -0xc0(%rbp), %rdi
callq 0x2a9a
movq 0x2933(%rip), %rdi      # 0x4fd8
leaq 0x9ed(%rip), %rsi       # 0x3099
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x108(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2b92
movq 0x2905(%rip), %rdi      # 0x4fd8
leaq 0x9bf(%rip), %rsi       # 0x3099
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq 0x925(%rip), %rsi       # 0x3013
leaq -0x348(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x20b0
movq 0x28d4(%rip), %rdi      # 0x4fd8
leaq 0x9b0(%rip), %rsi       # 0x30bb
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x70(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x23d9
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rbx
movq %rbx, %rsi
callq 0x2bf4
movq %rbx, %rdi
callq 0x2b0e
movq 0x288e(%rip), %rdi      # 0x4fd8
leaq 0x96a(%rip), %rsi       # 0x30bb
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x348(%rbp), %rdi
callq 0x2030
leaq -0x50(%rbp), %rdi
callq 0x2a9a
leaq 0x963(%rip), %rsi       # 0x30dd
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x2070
movq 0x284a(%rip), %rdi      # 0x4fd8
leaq 0x95f(%rip), %rsi       # 0x30f4
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2ac6
leaq 0x960(%rip), %rsi       # 0x3116
leaq -0x38(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x2070
leaq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2c5c
leaq -0x38(%rbp), %rdi
callq 0x2090
movq 0x27f5(%rip), %rdi      # 0x4fd8
leaq 0x90a(%rip), %rsi       # 0x30f4
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq 0x91d(%rip), %rsi       # 0x311b
leaq -0x70(%rbp), %rdi
callq 0x21c0
movq 0x27ca(%rip), %rdi      # 0x4fd8
leaq 0x90e(%rip), %rsi       # 0x3123
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0x38(%rbp), %rsi
movl $0xa, (%rsi)
leaq -0xa8(%rbp), %rdx
movb $0x63, (%rdx)
leaq -0x50(%rbp), %rdi
callq 0x2ca4
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2ce4
leaq 0x8f2(%rip), %rsi       # 0x3145
leaq -0x38(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x2070
leaq -0xa8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2160
leaq -0x140(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x2d38
leaq -0x50(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x2d0e
leaq -0x140(%rbp), %rdi
callq 0x2090
movq 0x272b(%rip), %rdi      # 0x4fd8
leaq 0x86f(%rip), %rsi       # 0x3123
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq -0xa8(%rbp), %rdi
callq 0x2090
leaq -0x38(%rbp), %rdi
callq 0x2090
leaq -0x70(%rbp), %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
callq 0x2b0e
leaq -0xc0(%rbp), %rdi
callq 0x2b0e
leaq -0x108(%rbp), %rdi
callq 0x2b0e
leaq -0xd8(%rbp), %rdi
callq 0x2b0e
leaq -0xf0(%rbp), %rdi
callq 0x2b0e
leaq -0x88(%rbp), %rdi
callq 0x2b0e
leaq -0x348(%rbp), %rdi
callq 0x2040
leaq -0x120(%rbp), %rdi
callq 0x2b0e
xorl %eax, %eax
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29a5
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x2090
jmp 0x29f9
jmp 0x29f6
jmp 0x2973
jmp 0x2a1f
jmp 0x2a1f
movq %rax, %rbx
jmp 0x2a05
jmp 0x2a1f
movq %rax, %rbx
jmp 0x2a2b
jmp 0x2a3b
jmp 0x2a3b
movq %rax, %rbx
jmp 0x2a4a
jmp 0x2a1a
jmp 0x2a15
jmp 0x2a36
jmp 0x2a10
movq %rax, %rbx
jmp 0x2a86
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x348, %rdi           # imm = 0xFCB8
callq 0x2090
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x29b4
jmp 0x2a92
jmp 0x29d5
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2090
cmpq %r14, %r15
jne 0x29d8
jmp 0x2a92
movq %rax, %rbx
jmp 0x2a92
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x2090
leaq -0x38(%rbp), %rdi
callq 0x2090
jmp 0x2a22
movq %rax, %rbx
jmp 0x2a7a
movq %rax, %rbx
jmp 0x2a62
movq %rax, %rbx
jmp 0x2a56
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
callq 0x2b0e
jmp 0x2a3e
movq %rax, %rbx
jmp 0x2a6e
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x2b0e
leaq -0x108(%rbp), %rdi
callq 0x2b0e
leaq -0xd8(%rbp), %rdi
callq 0x2b0e
leaq -0xf0(%rbp), %rdi
callq 0x2b0e
leaq -0x88(%rbp), %rdi
callq 0x2b0e
leaq -0x348(%rbp), %rdi
callq 0x2040
leaq -0x120(%rbp), %rdi
callq 0x2b0e
movq %rbx, %rdi
callq 0x21a0