Skip to content

Commit 5d0b8b3

Browse files
authored
Update ITEM26.md
1 parent f8c81f6 commit 5d0b8b3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

ITEM26.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ auto&& babo;
1616
2. 템플릿과 템플릿이 아닌 함수들이 똑같은 타입을 가지면 템플릿이 아닌 함수를 우선한다.
1717

1818
### Perfect Forwarding
19-
내가 받은
19+
내가 받은 대로 돌려주는 것. [참조](http://blog.naver.com/losemarins/221011603702)
2020

2121
### Example1
2222
```c++
@@ -38,3 +38,17 @@ hello((short) 20); // Fucking
3838
```
3939
4040
### Example2
41+
```c++
42+
class Person {
43+
public:
44+
template<typename T>
45+
explicit Person(T&& n) : name(std::forward<T>(n)) {}
46+
explicit Person(int idx);
47+
48+
Person(const Person& rhs); // defined by compiler
49+
Person(Person&& rhs); // defined by compiler
50+
};
51+
52+
Person p("Nancy");
53+
auto cloneOfP(p); // Fucking
54+
```

0 commit comments

Comments
 (0)