1 template<typename T>
2 struct X
3 {
4 static void f(const T& t)
5 {
6 t.a = 100;
7 }
8 };
9 struct S
10 {
11 int a;
12 };
13
14 int main(int argc, char* argv[])
15 {
16 S s;
17 X<S>::f(s);
18
16 S s;
17 X<S&>::f(s);
18
19 cout << s.a << endl;
1 template<typename T>
2 struct R
3 {
4 static void A(T&){}
5 static void B(const T&){}
6 static void C(T&&){}
7 static void D(const T&&){}
8 };
9
10 {
11 R<int&>::A(?)
12 R<int&>::B(?)
13 R<int&>::C(?)
14 R<int&>::D(?)
15
16 R<const int&>::A(?)
17 R<const int&>::B(?)
18 R<const int&>::C(?)
19 R<const int&>::D(?)
20
21 R<int&&>::A(?)
22 R<int&&>::B(?)
23 R<int&&>::C(?)
24 R<int&&>::D(?)
25
26 R<const int&&>::A(?)
27 R<const int&&>::B(?)
28 R<const int&&>::C(?)
29 R<const int&&>::D(?)
30 }
'정보 공유터' 카테고리의 다른 글
| YooKey, Cydia 실행 중 튕기시는 분들을 위한 글 (45) | 2011/01/25 |
|---|---|
| YooKey, "다음문장"을 "줄바꿈"으로 바꾸기. (76) | 2011/01/21 |
| iPhone, 무한 사과 발생시... 초기화 하지 않고 복구하는 방법 (11) | 2011/01/21 |
| [C++0x] r-vaule reference: 파라미터의 const 속성 없애기!? (1) | 2010/07/30 |
| [C++] r-value vs. l-value (1) | 2010/07/25 |
| [Apache] 찾을 수 없습니다. (3) | 2010/07/22 |
| [C++] r-value Reference: Performance (2) | 2010/07/13 |
