// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/exercises/ex16_24_main.cc
// Function: main
int main(int argc, char const *argv[])
{
	Blob<string> b1; // empty Blob
	cout << b1.size() << endl;
	{  // new scope
		Blob<string> b2 = {"a", "an", "the"};
		b1 = b2;  // b1 and b2 share the same elements
		b2.push_back("about");
		cout << b1.size() << " " << b2.size() << endl;
	} // b2 is destroyed, but the elements it points to must not be destroyed
	cout << b1.size() << endl;

	for(auto p = b1.begin(); p != b1.end(); ++p)
		cout << *p << endl;

	vector<string> vs = {"hello", "c++", "primer"};
	Blob<string> bs(begin(vs), end(vs));
	for (auto item : bs)
		cout << item << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x2adb
movq (%rbx), %rax
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x5, %rsi
movq 0x4c7f(%rip), %rdi      # 0x6fc0
callq 0x20c0
movq %rax, %rdi
callq 0x2090
leaq 0x1caf(%rip), %rsi      # 0x4004
leaq -0xf8(%rbp), %r14
leaq -0x80(%rbp), %rdx
movq %r14, %rdi
callq 0x2060
leaq -0xd8(%rbp), %r15
leaq 0x1c90(%rip), %rsi      # 0x4006
leaq -0x98(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0xb8(%rbp), %r15
leaq 0x1c76(%rip), %rsi      # 0x4009
leaq -0x68(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0x48(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
pushq $0x3
popq %rdx
callq 0x278c
pushq $0x40
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0xf8, %rdi
callq 0x2080
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x23b5
leaq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2986
leaq 0x1c2a(%rip), %rsi      # 0x400d
leaq -0xf8(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x2060
movq -0x48(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x2d9a
leaq -0xf8(%rbp), %rdi
callq 0x2080
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x5, %rsi
movq 0x4b9b(%rip), %rdi      # 0x6fc0
callq 0x20c0
leaq 0x1be2(%rip), %rsi      # 0x4013
movq %rax, %rdi
callq 0x2110
movq -0x48(%rbp), %rcx
movq 0x8(%rcx), %rsi
subq (%rcx), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x2090
leaq -0x40(%rbp), %rdi
callq 0x2a80
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x5, %rsi
movq 0x4b49(%rip), %rdi      # 0x6fc0
callq 0x20c0
movq %rax, %rdi
callq 0x2090
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x27ae
leaq -0x48(%rbp), %rbx
leaq -0x58(%rbp), %r15
leaq -0xf8(%rbp), %r12
movq 0x4b16(%rip), %r13      # 0x6fc0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27d8
movq %r12, %rdi
movq %rbx, %rsi
callq 0x27cb
movl %eax, %r14d
leaq -0x40(%rbp), %rdi
callq 0x2a94
testb %r14b, %r14b
je 0x24f6
movq %r12, %rdi
callq 0x2802
movq %r13, %rdi
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
callq 0x2090
movq %r12, %rdi
callq 0x2882
jmp 0x24aa
leaq -0xf0(%rbp), %rdi
callq 0x2a94
leaq 0x1b0c(%rip), %rsi      # 0x4015
leaq -0xf8(%rbp), %r14
leaq -0x80(%rbp), %rdx
movq %r14, %rdi
callq 0x2060
leaq -0xd8(%rbp), %r15
leaq 0x1af1(%rip), %rsi      # 0x401b
leaq -0x98(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0xb8(%rbp), %r15
leaq 0x1ad8(%rip), %rsi      # 0x401f
leaq -0x68(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0x48(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
pushq $0x3
popq %rdx
leaq -0x29(%rbp), %rcx
callq 0x28f8
pushq $0x40
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0xf8, %rdi
callq 0x2080
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x256d
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x2932
leaq -0x80(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x27ae
leaq -0x98(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x27d8
leaq -0x80(%rbp), %rbx
leaq -0x98(%rbp), %r14
leaq -0xf8(%rbp), %r15
movq 0x49f2(%rip), %r12      # 0x6fc0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27cb
testb %al, %al
je 0x2615
movq %rbx, %rdi
callq 0x2802
movq %r15, %rdi
movq %rax, %rsi
callq 0x2150
movq %r12, %rdi
movq %r15, %rsi
callq 0x2100
movq %rax, %rdi
callq 0x2090
movq %r15, %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2882
jmp 0x25ce
leaq -0x90(%rbp), %rdi
callq 0x2a94
leaq -0x78(%rbp), %rdi
callq 0x2a94
leaq -0x60(%rbp), %rdi
callq 0x2a80
leaq -0x48(%rbp), %rdi
callq 0x295a
leaq -0x50(%rbp), %rdi
callq 0x2a80
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x274e
movq %rax, %rbx
jmp 0x2757
movq %rax, %rbx
jmp 0x2760
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0xf8, %rdi
callq 0x2080
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x2678
jmp 0x277a
jmp 0x2699
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2080
cmpq %r14, %r15
jne 0x269c
jmp 0x277a
jmp 0x2717
jmp 0x2717
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x2080
jmp 0x270c
jmp 0x2709
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0xf8, %rdi
callq 0x2080
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x26d0
jmp 0x277a
jmp 0x26f1
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2080
cmpq %r14, %r15
jne 0x26f4
jmp 0x277a
jmp 0x2717
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2a80
jmp 0x277a
movq %rax, %rbx
jmp 0x277a
jmp 0x276b
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2a94
jmp 0x276e
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x2080
jmp 0x2742
jmp 0x273f
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2a94
leaq -0x78(%rbp), %rdi
callq 0x2a94
leaq -0x60(%rbp), %rdi
callq 0x2a80
leaq -0x48(%rbp), %rdi
callq 0x295a
jmp 0x277a
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x2a94
leaq -0x50(%rbp), %rdi
callq 0x2a80
movq %rbx, %rdi
callq 0x21c0
nop